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.

Errors while trying to connect after long time.

See original GitHub issue

Hey team,

We are using node-ibm_db driver for connecting to DB2.

If the app is let unused for sometime or hours together. We get the below errors randomly when trying to use it again.

We were using node-ibm_db V1.0.0 initially, and then updated to V2.0.0 still face these issues.

Error 1: May 08 00:40:21.log: { Error: [IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: “TCP/IP”. Communication API being used: “SOCKETS”. Location where the error was detected: “169.111.111.41”. Communication function detecting the error: “send”. Protocol specific error code(s): “110”, “", "”. SQLSTATE=08001

Error description: ETIMEDOUT - Connection timeout

Error 2: May 09 11:57:57.log: message: ‘[IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: “TCP/IP”. Communication API being used: “SOCKETS”. Location where the error was detected: “10.111.111.11”. Communication function detecting the error: “send”. Protocol specific error code(s): “104”, “*”, “0”. SQLSTATE=08001\n’,

Error description: ECONNRESET - Connection has been reset by partner

Error 3: May 18 14:19:07.log: message: ‘[IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: “TCP/IP”. Communication API being used: “SOCKETS”. Location where the error was detected: “10.111.111.11”. Communication function detecting the error: “recv”. Protocol specific error code(s): “**", "”, “0”. SQLSTATE=08001\n’,

Error description: ,,0 indicates the connection was closed by the peer. This could be any network device (i.e. firewall, router, workload balancing device, etc…) between the client and DB2 server, or the DB2 server itself.

Error 4: May 18 03:06:27.log: { Error: [IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: “TCP/IP”. Communication API being used: “SOCKETS”. Location where the error was detected: “169.111.111.41”. Communication function detecting the error: “send”. Protocol specific error code(s): “32”, “*”, “0”. SQLSTATE=08001

Error description: EPIPE (Broken Pipe)

Below is the code on how we create connection.

`
var ibmdb = require(‘ibm_db’); var pool = new ibmdb.Pool(); var connString = ‘DRIVER={DB2};’ + ‘DATABASE=’+dbName+‘;’+ ‘HOSTNAME=’+hostName+‘;’+ ‘UID=’+userName+‘;’+ ‘PWD=’+password+‘;’+ ‘PORT=’+port+‘;’+ ‘CURRENTSCHEMA=’+schema+‘;’ ‘PROTOCOL=TCPIP’;

 module.exports = {
    openConnection : function(callback){
    pool.open(connString, function (err , connection) {
    // Log Error
  
   if (err){
     return console.log(err);
   } else{
      callback(connection);
   }
  });
}

};`

Can you please help us solve this issue?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
fnschroedercommented, Jul 20, 2017

Ok, so in an effort to assist others with such issues:

Our path of success (with Bimal’s help):

  1. Configure alternate server on your DB (even if the alternate server is the same one as the original if you don’t have a cluster): db2 update alternate server for database OUR_DB using hostname OUR_HOSTNAME port OUR_PORT

  2. Configure your db2dsdriver.cfg to recover from failures and have better connection handling parameters. Ours look like this:

<configuration>
   <dsncollection>
      <dsn alias="certappDB" name="DBNAME" host="DB_HOSTNAME" port="DB_PORT"/>
   </dsncollection>
   <databases>
      <database name="DBNAME" host="DB_HOSTNAME" port="DB_PORT">
         <parameter name="userid" value="DB_USERNAME"/>
         <parameter name="password" value="DB_PASSWORD"/>
         <parameter name="CurrentSchema" value="DB_SCHEMA"/>
         <parameter name="KeepAliveTimeout" value="20"/>
         <parameter name="ConnectionTimeout" value="10"/>
         <parameter name="MemberConnectTimeout" value="1"/>
         <acr>
          <parameter name="enableACR" value="true"/>
          <parameter name="enableSeamlessACR" value="true"/>
          <parameter name="acrRetryInterval" value="2"/>
          <parameter name="maxAcrRetries" value="30"/>
          <parameter name="affinityFailbackInterval" value="2"/>
          <alternateserverlist>
            <server name="S1" hostname="DB_HOSTNAME" port="DB_PORT"/>
            <server name="S2" hostname="DB_HOSTNAME" port="DB_PORT"/>
          </alternateserverlist>
          <affinitylist>
            <list name="list1" serverorder="S1,S2"/>
          </affinitylist>
         </acr>
      </database>
   </databases>
</configuration>

Where ALIAS_NAME is the name you want to give to your datasource, DBNAME is the database name over DB2, DB_HOSTNAME is the hostname of your DB2 server, DB_PORT is the port that your DB2 server listens on, DB_USERNAME is the user you use to connect to the DB, DB_PASSWORD the password used by DB_USERNAME to connect and DB_SCHEMA is the actual schema where your DB artifacts are created into.

We are now recovering automatically from failures, retrying one every second for 1 hour (3600 attempts each second) in the event things go wrong, having a keepalive of 5 seconds, aggressive timeouts of 2 secs to wait for a connection to be established with DB.

Hope this helps others and thanks Bimal for the guidance into this. This can be closed.

0reactions
bimalkjhacommented, Jun 27, 2017

Thanks @fnschroeder for well documenting the steps to help others. Closing the issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the ERR_CONNECTION_TIMED_OUT Error - Kinsta
When you visit a website and it doesn't load, your browser will try for around 30 seconds or so until it terminates the...
Read more >
[SOLVED] How to Fix the ERR_CONNECTION_TIMED_OUT ...
Ways to Fix Err_Connection_Timed_Out Error · Method 1: Try VPN · Method 2: Flush DNS Cache · Method 3: Check Your Connection ·...
Read more >
11 Ways to Fix the ERR_CONNECTION_TIMED_OUT Error
When your internet connection times out and you can't access a specific webpage, it's one of the most annoying errors.
Read more >
Why is a Website 'Taking Too Long to Respond' & How to Fix
The 'taking too long to respond' error indicates that there is a communication problem between the target server and the client (your web ......
Read more >
Fix connection errors - Google Chrome Help
You'll see this error when the page has tried to redirect you too many times. Sometimes, pages don't open because cookies aren't working...
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