oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
345 stars 70 forks source link

Why expired connections in thin pool are force closed? #393

Open golubovai opened 2 months ago

golubovai commented 2 months ago

Hello! Force close of expired connections from pool prevent normal completion and execution of logoff triggers. Why are they force closed instead of normal close?

anthony-tuininga commented 2 months ago

The main reason is that simply disconnecting the socket is guaranteed whereas sending the LogOff request may result in a hang -- which could impact the pool negatively. What do you mean by "expired connections"? When using a pool the general concept is that which connection is used is immaterial and the pool should be able to substitute connections or rebuild them at will.

golubovai commented 2 months ago

"expired connections" are idle connections in pool closed after timeout, set by so named parameter in pool constructor. Our database tracks connections by means of logon/logoff triggers. These connections look like they were killed.

cjbj commented 3 weeks ago

@golubovai what exactly does your app rely on the logoff trigger to do? From the app's point of view, the connection was no longer needed, or usable, when the app released it back to the pool. What do you gain from some, unknown time later running a trigger?

@anthony-tuininga we should revisit Thin/Thick behavior with the OCI team.