-
Notifications
You must be signed in to change notification settings - Fork 2.5k
connection error prevents pool from ending connection #964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
conn.query('') = any invalid query |
Ah ha, I see now. So what is happening is is a sequence, like query, doesn't have an error handler (either an error event listener or a callback function), then the error is not handed to the sequence, but as a consequence, the end event for the sequence will never fire. Seems like a bug to me, since we're not being consistent on when the end event is emitted. Since it currently emits on an error, it should still emit in this case as well :) |
@dougwilson thanks! yes, that would be more expected behaviour. |
Actually the end event is being fired; the problem is that, since there are no listeners to the error event, it bubbles up to PoolConnection, which, in turn, will call _removeFromPool. This will remove any references to the connection, and when we try to end the pool, the connection won't be ended/destroyed, causing a stall. |
In my previous pool request, I assumed that all errors would trigger this.on('error', function() {
self._removeFromPool();
self.destroy();
}); This also fixes the dangling connection issue and passes the tests. |
I believe this issue got fixed at some point, based on me not being able to reproduce anymore. If someone can reproduce with version 2.6.1+, please open a new issue/PR and let me know! |
This doesn't work as expected (pool doesn't end, script doesn't exit)
however, this works (pool closes connections and script exits)
Thanks for the great lib!
The text was updated successfully, but these errors were encountered: