If a lock wait occurs during the processing of a FOREIGN KEY constraint, InnoDB will fail to resume the FOREIGN KEY operation once the conflicting lock has been released.
The problem was introduced in
MDEV-13331, in the function row_ins_check_foreign_constraint():
We should not assign other values than DB_LOCK_WAIT_TIMEOUT to err here. The following code works both for innodb.foreign_keys and the MySQL 5.7 test innodb.update-cascade which had been missing from MariaDB: