oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit #1612

Closed Andrija-Markovic closed 9 months ago

Andrija-Markovic commented 9 months ago

Oracle DB Version: "Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.19.0.0.0" Nodejs Version: 16.4.0 OracleDB.versionString: 6.0.2 OracleDB.oracleClientVersionString: could not get it because I am running in Thin mode process.platform: win32 process.version: v16.4.0 process.arch: x64

package.json dependencies: "oracledb": "^6.0.2", "@types/oracledb": "^5.3.1",

Application Setup

I have an Expressjs app written in TypeScript running on Node. The application connects to an Oracle DB solely to read data from it. This is how the app creates the connection pool:

this.connPool= await OracleDB.createPool({
    user: config.DB_USER,
    password: config.DB_PWD,
    connectionString: config.DB_CONN
});

When a connection is needed the app does:

await this.connPool.getConnection();

And it also releases the connection when no longer needed by doing:

await conn.release();

Problem Description

I performed load testing, and a lot of requests came back with error: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit. I worked with a DBA to get the information on how many sessions the config.DB_USER can have and the answer is 10.

So, how do I configure node-oracledb so that this SESSION_PER_USER limit is followed?

pvenkatraman commented 9 months ago

You have not provided the pool parameters like poolMin, poolMax, poolIncrement. You poolMax should not exceed SESSION_PER_USER value.

Andrija-Markovic commented 9 months ago

poolMax value by default is 4 (which is less than SESSION_PER_USER limit), yet the error is happening. So, I am not convinced that setting poolMax to 10 would change anything.

sudarshan12s commented 9 months ago

@Andrija-Markovic, Can you please confirm with 6.1.0 node-oracledb version , It may be similar to this issue

Andrija-Markovic commented 9 months ago

@sudarshan12s I updated to v6.1.0 and the issue seems to have gone away. I've been also monitoring pool.connectionsOpen and pool.connectionsInUse and they are all not exceeding poolMax value. Thanks for the suggestion. I will close the issue now.