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

Python GIL deadlock on server connecting

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 1.0.7
    • N/A
    • Other
    • 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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.