Search code examples
node.jsoraclenode-oracledb

NodeJS accessing Oracle DB getConnection() blocking, browser the message appears "server does not respond " after a few hours


we are using https://github.com/oracle/node-oracledb to connect to Oracle DB with nodejs, oracle client library 18.0. Everything works fine till a few hours later, the browser shows "Server does not respond". It is quite similar to the issue at https://github.com/oracle/node-oracledb/issues/725, where the blocking on getConnection() happens. We tried poolPingIntervalSetting and it was not working. Any idea?


Solution

  • The most common issue is not having enough threads. See https://oracle.github.io/node-oracledb/doc/api.html#numberofthreads If the pool grows due to load but you don't have enough threads, you may lock up.

    Then make sure your application is releasing connections back to the pool, including in error situations. Use pool._logStats() and see if you are leaking connections.

    Review the node-oracledb doc on connection pool best practices https://oracle.github.io/node-oracledb/doc/api.html#conpoolsizing

    Look at network issues and make sure firewalls etc aren't killing sessions. Open an issue on GitHub to take this further.