Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
1.0.7
-
None
-
OS: Archlinux
Python: 3.9.6
Description
When the user code calls mariadb.connect to connect to a database, the mariadb package calls a C function MrdbConnection_connect.
Before MrdbConnection_connect returns, the thread hold Python GIL. It means the whole python process is locked, and unable to continue.
If the user run a ssh tunnel using python in same process and the user tries to proxy the mariadb connection using this tunnel, a deadlock will happen.
The MrdbConnection_connect requires the ssh tunnel to send its data to real server. But it does not give the GIL. So ssh tunnel can never run and send the data to real server, because it need take the GIL to eval code.
So is it possible to realease GIL before calling C function? This will resolve the deadlock.