Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
oracledb not releasing connection from pool after disconnect #3605
Knex version: 0.20.6
When oracledb falls of the network or the application can't connect and there's an open transaction, the pool doesn't empty. After the pool is full we see
The crux is:
If you disconnect during the sleep then the
Connection should not be removed from pool at that point yet. However it should be marked to be disposed next time when it is tried to be aqcuired from pool.
Your example is also using transactions in an invalid way, that might be the reason why you are getting unhandled rejection. Check transaction provider from latest docs and set rejectioin handlers properly.
It is not documented well, but
Lets reopen if this seems to work wrong after you have fixed your transcation code.
I updated my example in the linked repo: https://github.com/jakecoffman/knex-oracle-bug/blob/68ea525f0ea2887f50e29c1ef3a7ba0fb9b6786e/index.js
I changed it to match how you use transactions in the issue you linked. I removed the call to commit as I think that's a separate issue.
I'm still seeing it not release the connection at the end of the script running. Here's the output when I pull the network cable during the sleep:
I've tracked down what is happening:
And actually looks like this code is invalid since
I can put a PR up for this.