loopbackio / loopback-connector-ibmi

Other
2 stars 4 forks source link

Connections Left Open #10

Closed dave-apex closed 4 years ago

dave-apex commented 4 years ago

We hit an issue on Sunday in production where there were LOTS of open jobs on the iSeries. After digging into the code and adding console.logs in various places, we found that line 836 in ibmiconnector.js needs to be commented back in. Without it, a new connection will be acquired by each call to this.pool.connect on line 816 and none of them are ever closed. We would be happy to assist in the fix if you like.

markdirish commented 4 years ago

Hi Dave,

I am finalizing a big overhaul of this package hopefully to be merged into npm later this week. In that rewrite, it looks like I have changed the logic of executeSQL, and it just uses the pool.query function of the odbc connector, which should close connections automatically after returning results.

Would you mind downloading it and seeing if it remedies the problem? The current code can be found at: https://github.com/markdirish/loopback-connector-ibmi

To install using npm, you should be able to do:

npm install --save markdirish/loopback-connector-ibmi#master

Hopefully the issue is already solved and will be available for release on npm soon!

dave-apex commented 4 years ago

Hi Mark,

Thanks for the quick response! Yes, I see your use of pool.query and that should work perfectly. We look forward to that being published on NPM. We have a monkey patch in place to hold us until then :).

Thanks, Dave

dave-apex commented 4 years ago

Mark,

FYI. We tried using the pool.query in a monkey patched version of the connector and it worked well in one environment but seemed to slowly add additional connections over time. We did not have time to analyze it further. We switched to just using connect, query, close and that worked fine. I hope that it was some anomaly of our testing but I fear that there could be some issue lurking in there. We had our as/400 guy check the number of open jobs for our app and that is how we found that some connections were still open.

We of course can do the same test again with your new version when it comes out :).

Thanks, Dave

markdirish commented 4 years ago

I think the issue with pool getting slow over time isn't a loopback-connector-ibmi issue, but an odbc issue. I will have to do a little more in depth check to make sure that everything works well on that end over the next week.

But I also wanted to let you know that v 1.0.0 is now available for loopback-connector-ibmi, can get it on npm with: npm i loopback-connector-ibmi!

stale[bot] commented 4 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 4 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.