[cx-oracle-users] cx_oracle 5.1 patch to release python gil during OCIPing
Brought to you by:
atuining
From: Lassi T. <la...@ce...> - 2011-12-12 06:02:34
|
Hi, The attached patch releases the python interpreter lock during an OCIPing() and OCIBreak() calls. We have a client app which uses connection caching, and we've found that if a TCP connection to the database server was already established, but then goes sour, the call to connection.ping() will freeze the entire python interpreter until OCIPing() returns. That in turn appears to take very long to happen, even in presence of TCP keep-alive settings and ENABLE=BROKEN. Other threads in our application need to be able to run while the oracle client library ponders about the bad connection. From looking at the code it seems OCIBreak() may also need similar wrapper, but we don't use connection.cancel() so I am uncertain if it's prone to hanging. I added the wrapper as it seems unlikely to cause much overhead. Tested with cx_oracle 5.1, instant client 11.2.0.1.0 (linux) and 10.2.0.4.0 (os x) connected to server 10.2.0.5.0, with different sorts of induced network outages. Regards, Lassi |