tediousjs/tedious-connection-pool

Keep getting acquire Timeout error

iamtennislover opened this issue · 7 comments

I keep getting acquire Timeout, even after closing all the sessions and calling connection.release(); connection.close();. I would like to know what I can do to avoid this situation?

Does acquire timeout error indicate that the sessions are not getting closed?

It looks like the status is set to PENDING and doesn't change to FREE. I am using latest version

Are your database credentials correct? Are you able to make queries before calling release()? If so, will you put together a simple example that demonstrates the problem?

Yes, i have the right credentials. Yes, I am able to make queries before connection.release() too. I think i solved it once I removed connection.close(). Not sure, why, but certainly that was the problem. In regards to a simple example, the issue came up only when I had many connections to the server. I don't have a example yet, but i will once the issue comes again. thanks

That seems likely. I never built a unit test for close(). There are very few reasons to ever call it. It removes all the benefit of using the connection pool. I'll see if I can reproduce the behavior.

cool. thanks for ur help. i am actually new to database (and obviously very new to connection pooling), so thats why i wasn't using the tedious lib the right way

No problem. The best way is to just release the connection, so that it can be reused.

FYI, I was able to reproduce the issue you described with calling close() and then release(). I fixed it so the connection pool will ignore calls to release() if the connection has been closed. I also tried improve the documentation and example to make the usage of release() more clear.

great. thanks