loopbackio / loopback-connector-oracle

Connect Loopback to Oracle
http://loopback.io/doc/en/lb3/Oracle-connector.html
Other
28 stars 30 forks source link

Connection Released, not Reconnecting #134

Closed rudijs closed 7 years ago

rudijs commented 7 years ago

Hi,

I'm having a problem with loopback:connector:oracle not reconnecting.

After a while the connection is 'released' then I have to restart the express app to reconnect.

I might have overlooked, but haven't found any 'reconnect' options.

I'm not sure what I can do to remain 'connected'.

Any tips, advice or direction would be greatly appreciated.

Thanks.

node -e 'console.log(process.platform, process.arch, process.versions.node)'
linux x64 6.9.5
npm ls --prod --depth 0 | grep loopback                                       
npm info it worked if it ends with ok                                           
npm info using npm@3.10.10                                                      
npm info using node@v6.9.5                                                      
+-- loopback@3.8.0                                                              
+-- loopback-boot@2.24.0                                                        
+-- loopback-component-explorer@2.7.0                                           
+-- loopback-connector-oracle@3.2.0                                             
+-- loopback-datasource-juggler@2.54.1                                          

Here's my datasource.js config:

module.exports = {
  "ODS": {
    "tns": secret.ODS_TNS,
    "user": secret.ODS_USERID,
    "password": secret.xxxxxxxx,
    "connector": "oracle",
    "minConn":3,
    "maxConn":10,
    "incrConn":3,
    "timeout": 180
  },
  "db": {
    "name": "db",
    "connector": "memory"
  }
}

Here's a debug log entry when the connection gets released:

Mon, 19 Jun 2017 22:16:58 GMT loopback:connector:oracle Result: []
Mon, 19 Jun 2017 22:16:58 GMT loopback:connector:oracle Connection released:  Pool {
  poolPingInterval: 10,
  stmtCacheSize: 30,
  connectionsInUse: 1,
  connectionsOpen: 3,
  poolTimeout: 180,
  poolIncrement: 3,
  poolMin: 10,
  poolMax: 100,
  setMaxListeners: [Function: setMaxListeners],
  getMaxListeners: [Function: getMaxListeners],
  emit: [Function: emit],
  addListener: [Function: addListener],
  on: [Function: addListener],
  prependListener: [Function: prependListener],
  once: [Function: once],
  prependOnceListener: [Function: prependOnceListener],
  removeListener: [Function: removeListener],
  removeAllListeners: [Function: removeAllListeners],
  listeners: [Function: listeners],
  listenerCount: [Function: listenerCount],
  eventNames: [Function: eventNames],
  domain: null,
  _events: { _after_close: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  queueRequests: [Getter/Setter],
  queueTimeout: [Getter/Setter],
  poolAlias: [Getter/Setter],
  getConnection: [Function],
  terminate: [Function],
  close: [Function] }

This is after I restart the loopback app:

Tue, 20 Jun 2017 01:25:42 GMT loopback:connector:oracle Connected to DB1DEV
Tue, 20 Jun 2017 01:25:42 GMT loopback:connector:oracle Connection pool  Pool {
  poolPingInterval: 10,
  stmtCacheSize: 30,
  connectionsInUse: 0,
  connectionsOpen: 10,
  poolTimeout: 180,
  poolIncrement: 3,
  poolMin: 10,
  poolMax: 100,
  setMaxListeners: [Function: setMaxListeners],
  getMaxListeners: [Function: getMaxListeners],
  emit: [Function: emit],
  addListener: [Function: addListener],
  on: [Function: addListener],
  prependListener: [Function: prependListener],
  once: [Function: once],
  prependOnceListener: [Function: prependOnceListener],
  removeListener: [Function: removeListener],
  removeAllListeners: [Function: removeAllListeners],
  listeners: [Function: listeners],
  listenerCount: [Function: listenerCount],
  eventNames: [Function: eventNames],
  domain: null,
  _events: { _after_close: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  queueRequests: [Getter/Setter],
  queueTimeout: [Getter/Setter],
  poolAlias: [Getter/Setter],
  getConnection: [Function],
  terminate: [Function],
  close: [Function] }
raymondfeng commented 7 years ago

@rudijs Can you try to set up poolTimeout: 0? See https://github.com/oracle/node-oracledb/blob/master/doc/api.md#propdbpooltimeout.

rudijs commented 7 years ago

@raymondfeng Thanks. We've just deployed this and will let it run for a few days.

I'll post back my results.

cjbj commented 7 years ago

How is the connection 'released'?

raymondfeng commented 7 years ago

@cjbj See https://github.com/strongloop/loopback-connector-oracle/blob/master/lib/oracle.js#L254.

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 7 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

DELINGE commented 6 years ago

Please @rudijs can you please hide this page and the refernce to AXA ? And also the password MAny thanks

rudijs commented 6 years ago

@DELINGE Done.

jeyaraj87 commented 6 years ago

any update on this post. we are also facing similar issue in our application. loopback oracle connector not able to acquire the connection from pool if the application is idle for 60 minutes. we have to restart the application to acquire back the connection.