Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-157

Python GIL deadlock on server connecting

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 1.0.7
    • Fix Version/s: N/A
    • Component/s: Other
    • Labels:
      None
    • Environment:
      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.

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            site-mariadb Zhai Zhaoxuan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration