"Communication link failure" state:"08S01" on a connection pool
See original GitHub issueHi,
I have question about using connectionpool
on my server.
I have defined a global variable named connection pool and when I want to query database I use it to query. that works fine but there is a problem that I think after a while being idle the server closes the connections and I face this error. "Communication link failure" state:"08S01"
which the cause is explained here.
https://www.ibm.com/support/pages/odbc-client-connections-dropping-intermittently-error-communication-link-failure
Is there any way to workaround this problem in node-odbc?
Issue Analytics
- State:
- Created 4 years ago
- Comments:33 (4 by maintainers)
Top Results From Across the Web
Communication link failure when checking out a schema - IBM
Microsoft details the cause of the Communication Link Failure under SQLState 08S01, as an error that occurs when the communication link between the...
Read more >SQL Error: 0, SQLState: 08S01 Communications link failure
1.use connection pool to execute Query, make sure the pool class has a function to make an inspection of the connection members before...
Read more >Communications link failure in Percona MySQL 5.7.24
ERROR Database access problem. Killing off this connection and all remaining connections in the connection pool. SQL State = 08S01 ERROR ...
Read more >Communication Link Failure - JBoss.org
Hi, I have implemented a simple connection pooling using Jboss Appication Server 7 DataSource ds = (DataSource) new.
Read more >Solved: Re: Hive-druid: cannot create external database
TTransportException (state=08S01,code=0) ... There is a problem with a connection from the pool, retrying(rc=9): Communications link failure.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any changes should just have to be done in JavaScript: Connections have a .connected property that calls SQLGetConnectAttr with the SQL_ATTR_CONNECTION_DEAD option. Returns true if SQL_ATTR_CONNECTION_DEAD returns false (since it makes much more sense for .connected to return true if its… connected). I imagine the code would just check:
Maybe the issue is here: https://github.com/markdirish/node-odbc/blob/69f49bd4703e569ef01693f4d9241bcdeffa5b00/lib/Pool.js#L253
I think an assumption is being made that the connection that’s being popped is a good connection, and perhaps
connection.connected
should be checked on the popped connection. This will make sure the connection is good and if its not, to create a new connection.Unless the developer using the node-odbc pool is expected to try catch when they run
pool.query
and catch the connection error messageThen reinstantiate the pool. Which seems odd to me since I feel the pool should be gracefully handling dead connections without the developer needing to do anything.
Going back to the php_odbc.c source comparison. node-odbc doesn’t have a
It just has a function to check for a dead connection. It would be nice if node-odbc realized it had a dead connection and replaced it with a new connection.