question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Communication link failure" state:"08S01" on a connection pool

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:33 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
markdirishcommented, Feb 4, 2020

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:

if(!connection.connected) {
// close connection
// open a new connection and add it to pool
}
1reaction
phpdavecommented, Sep 22, 2022

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 message

State 08S01 Code 10054 [IBM][System i Access ODBC Driver]Communication link failure. comm rc=10054 - CWBC01047 - The IBM i server application disconnected the connection.

Then 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.

 pool = await odbc.pool({
    connectionString,
    initialSize: 5,
    maxSize: 10,
  });

Going back to the php_odbc.c source comparison. node-odbc doesn’t have a

goto try_and_get_another_connection;

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found