ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
191 stars 149 forks source link

CLE0600E invalid connection handle or connection closed #1007

Open jptech8 opened 3 weeks ago

jptech8 commented 3 weeks ago

When IBMDB2 undergoes maintenance, it shows this kind of issue even after the IBMDB2 back online " CLE0600E invalid connection handle or connection closed"

But the expection the setting below ,it should create or establish the connection and execute the query without any issue . Pool:{ maxPoolSize:10, ConnectTimeout:60, AutocleanIdle:true, IdleTimeOut:1200, PoolSize:10 } Let pool = new ibm_db.pool(pool) pool.init(pool.poolsize,db2config)

I have followed the documentation as suggested but still this is happening during maintenance and randomly once in a while .

Please help on this

bimalkjha commented 1 week ago

@jptech8 For such issue, we have added test program test/test-pool-stale-connections.js under ibm_db directory. Could you please update database connection info in file test/config.json, update timeout in test program to 20 seconds and run test file as per instructions in it to reproduce the issue?

Actually, we restart the db2 server after first query execution to simulate the maintenance case which causes all connections in pool broken, so returning SQL30081N error. On next query execution, connection get re-established automatically. You need to login on db2 server and restart it using db2stop force; db2start command. Try running this command on server before running test program to make sure it works for you. Please try to reproduce your scenario by updating this test file and share here. Thanks.

bimalkjha commented 3 days ago

@jptech8 Any update about it? Thanks.

jptech8 commented 1 day ago

I don't have access to db2 server to supply force and restart command, Is that any other way? This usually happens when server undergoes maintenance and also when we restart the k8 pods, it started working fine. However Please suggest the permanent solution on this.

Capture
bimalkjha commented 1 day ago

@jptech8 If you have database connection string to connect to server, you can open that host in putty and try to login using the dbuser and dbpass. This test program will not reproduce the issue if you do not restart the server.

Another thing is please share output of npm ls ibm_db command. If you are using older version of ibm_db, please install latest version as we have fixed few issues related to your case in recent past releases. Thanks.