What's the expected behaviour for closed connections to DB when network/VPN disconnects?
oracledb version 5.2.0 node version 14.14.0 docker image node:14.14.0-stretch-slim oracle client - instantclient-basiclite-linux 21.1
Just wondering what the expected behaviour is when you start node-oracledb and it creates a pool with this example configuration.
If I try to start the application and create the pool when off VPN, I have no connection to the network where the DB resides so I receive the expected ORA-12154: TNS:could not resolve the connect identifier specified error.
But if I am connected to the VPN, start the application, create the pool successfully and then disconnect from the VPN, no errors are received.
Based on the pool configuration below, 2 connections are established to the DB at the time of pool creation. When I disconnect from the VPN shouldn't poolPingInterval detect that the connection has been closed and return an error like DPI-1080: connection was closed by ORA-3113?
If I try to execute a query after disconnecting from the VPN I do receive DPI-1080: connection was closed by ORA-3113.
Is the expected behaviour for closed connection errors to only be thrown for established connections after a query is attempted using a connection from the pool? Is there a listener in oracledb listening on the socket?
await oracledb.createPool({
user: process.username,
password: process.password,
poolAlias: "coolPool",
poolIncrement: 0,
poolMin: 2,
poolMax: 2,
poolPingInterval: 60,
poolTimeout: bilbyPoolTimeout,
queueMax: 500,
queueTimeout: 90000,
//enableStatistics: true, // Set to true to enable recording of pool statistics
});
@amroczeK did you wait 60+ seconds after returning the connections to the pool and before calling pool.getConnection()? Try with poolPingInterval:0 to always force the round-trip ping at each pool.getConnection().
@cjbj yeah I did wait an extended period of time and didn't experience any errors thrown after disconnecting from the VPN until I tried to retry a query.
Not sure if there is an event listener in node-oracledb which immediately triggers/throws an error to the client after an established connection in the pool is closed.
There's no event handler for that because the underlaying C layer doesn't pass that info back up out of the Session Pool. However it does tell us when new connections are created, which is how we know when to call the session callback function.
I've pinged @onmp to see what he thinks.
This is the expected behavior. Disconnecting VPN is same as bringing down a network interface, connections do not know the lost of network until it tries to execute an I/O operation.
@onmp the poolPingInterval setting will initiate an OCIPing round-trip to the DB. Is there anything about VPN state that will affect this?
Hi Chris,
A VPN connection is sane as a normal network connection and will not affect the poolPingInterval and connection pinging. The behavior is expected because during getConnection(), the ping is performed, the connection is determined to be unusable, unable to establish a new connection because the VPN connection is closed, thus returning an error.
Regards, Normabn
From: Christopher Jones @.> Sent: Thursday, July 15, 2021 4:00 PM To: oracle/node-oracledb @.> Cc: Norman Woo @.>; Mention @.> Subject: [External] : Re: [oracle/node-oracledb] What's the expected behaviour for closed connections to DB when network/VPN disconnects? (#1396)
@onmphttps://urldefense.com/v3/__https://github.com/onmp__;!!ACWV5N9M2RV99hQ!ZX95TCs-YoKcEaXrYh_64xtyvlKsH0EfeSKtNfOKmr6hcTMuLUNkKbW_sv6aiFBS$ the poolPingInterval setting will initiate an OCIPing round-trip to the DB. Is there anything about VPN state that will affect this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/oracle/node-oracledb/issues/1396*issuecomment-881062562__;Iw!!ACWV5N9M2RV99hQ!ZX95TCs-YoKcEaXrYh_64xtyvlKsH0EfeSKtNfOKmr6hcTMuLUNkKbW_smmroV0h$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ALQHCXTQZW4HBVZLNFCU6R3TX5R77ANCNFSM5AKPBIIQ__;!!ACWV5N9M2RV99hQ!ZX95TCs-YoKcEaXrYh_64xtyvlKsH0EfeSKtNfOKmr6hcTMuLUNkKbW_sig3thoh$.
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not been updated for a month.