Skip to content

Paramiko / SSHTunnel hang #594

Open
Open
@markfinn

Description

@markfinn

I'm on version 7.3, dealing with an issue similar to #158 that seems to have a similar solution.

When using a pure python ssh tunnel with a cx_oracle pool still hangs for me. Using an external tunnel is fine.

Based on the fix in #158 (releasing the GIL) I checked out what threads where waiting inside the cx_Oracle*.so and think that the call to dpiStmt_close() inside cxoCursor_close() might also need the GIL released while waiting. Doing that seems to fix my hang. I don't really have any understanding of which dpi* functions make external calls, so I don't know if this also should have included the dpiStmt_release() call.

static PyObject *cxoCursor_close(cxoCursor *cursor, PyObject *args)
{
+    int status;
     if (cxoCursor_isOpen(cursor) < 0)
         return NULL;
     Py_CLEAR(cursor->bindVariables);
     Py_CLEAR(cursor->fetchVariables);
     if (cursor->handle) {
-        if (dpiStmt_close(cursor->handle, NULL, 0) < 0)
+        Py_BEGIN_ALLOW_THREADS
+        status = dpiStmt_close(cursor->handle, NULL, 0);
+        Py_END_ALLOW_THREADS
+        if (status < 0)
             return cxoError_raiseAndReturnNull();
         dpiStmt_release(cursor->handle);
         cursor->handle = NULL;
    }
    cursor->isOpen = 0;

    Py_RETURN_NONE;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions