While trying to get write lock of some table with:
LOCK TABLE infoTable write;
My Python3 script is blocked, and show processlist indicates the script is blocked by waiting to get the write lock:
Waiting for table metadata lock
However, the target table infoTable is not locked by any session, as the result of show open table tells:
mysql> show open tables where In_use > 0;
Empty set (0.00 sec)
So how comes that getting the write lock is blocked while the table is not locked by any other session?
Follow up1: As suggested by comment, I tried to get lock status of transaction, no transaction is locking the target table.
mysql> SELECT * FROM INNODB_LOCK_WAITS;
Empty set, 1 warning (0.00 sec)
Additional info for your reference: mysql version: mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper
OS info: Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux