-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
[createConnection] Can't add new command when connection is in closed state #2640
Comments
usually this means that you missed error handling somewhere and try to do something on a connection that is no longer alive ( you closed it earlier, or server disconnected it's side of a connection, or network link dies and OS marked tcp connection as closed and that was propagated as net socket 'error' event ) The connection itself is not designed to "reconnect", all state is meaningless for a new connection anyway. Whenever fatal error happens you supposed to discard a connection object and create a new one. Easiest way to do all that automatically is to use a pool ( even if you don't need pool for performance reasons ) |
Thank you @sidorares for the prompt reply! I've been digging a bit more into the issue. TLDR: the problem seems basically the one reported at #1398. The db has been recently updated from version 5 to 8 (mysql_aurora.3.06, which maps to 8.0.34, ref here). The new version is using I've tried to set the charset when creating the connection with Long story: I was seeing the error |
I've been trying different charset when creating the connection, but the error is still there. I've also enabled the debug flag, but the info doesn't seem useful (it is mostly alphanumeric strings, and statements like The connection gets closed after update and insert statements. As temporally workaround, I'm executing a
|
I've written some code in python (using pymsql) to check if the problem is on the DB side. In python, I'm not able to replicate the issue, the connection doesn't get closed after executing an insert statement |
@valcos-eb can you make a repro repo so I can try to debug you issue locally? |
hey @sidorares, sure! For the moment I'm not able to reproduce the issue locally. I've tried with a docker-compose (https://github.com/valeriocos/test-mysql2), hoping that this was enough to replicate the error. Next week I'll try with cdk + lambda (which is a better approximation of my use case), and let you if the issue is reproduced. |
hey @outbackStack, if this can be of any help, the solution commented here is working in a prod environment (for the moment it seems an effective workaround) |
Hello!
Checking previous issues on Can't add new command when connection is in closed state, it seems that there is no workaround for this error and
createConnection
. Is this right or am I missing something?I'm using MySQL 8 and mysql2
3.9.7
.The text was updated successfully, but these errors were encountered: