Unhandled Exception in connection.end()
for MySQL Dialect
#1691
Labels
Comments
Yikes, sorry about that.
Basically it's there just to clean up any listeners hanging around that aren't needed anymore since the connection shouldn't be accessible for any purpose once it's "destroyed" anyway. I think this would be the preferred solution: connection.end(err => {
err.__knex__disposed = err
}) or maybe even: destroyRawConnection(connection) {
connection.end(() => {
connection.removeAllListeners()
})
} so that any error handler still exists until after the connection is definitely ended. |
Just pushed a fix in 0.12.2, thanks for the report! |
tgriesser
added a commit
that referenced
this issue
Oct 9, 2016
RubenSlabbert
added a commit
to RubenSlabbert/knex
that referenced
this issue
Nov 9, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's an open issue on the mysql repo for ClearDB not responding the a Quit packet.
This affects knex when destroying an idle connection using
Client_MySQL.destroyRawConnection()
.The unhandled exception thrown by mysql on
connection.end()
was crashing my application and there is really no way to handle it as knex is currently setup.I would be willing to open a PR and fix the bug, but I'm not sure which strategy is most appropriate.
The easiest would be to remove the call to
removeAllListeners()
, according to the NodeJS docsThat said, I'm assuming there is a reason knex is calling this method? Maybe something to do with performance?
An alternative would be to pass in an error callback to `.end()', for example:
Let me know which approach would be best and I'll make the change and open a PR.
As a workaround, for anyone else experiencing issues with knex, heroku, mysql, and cleardb I've done the following and it works for now but is fairly ugly...
The text was updated successfully, but these errors were encountered: