Can't add new command when connection is in closed state
See original GitHub issueThis happened to me today when i upgrade to 0.14.0. Not sure when the bug was introduced.
Also, i saw this along with the above message: This socket has been ended by the other party
Previously working version seems to be 0.13.0
node 8.9.1, knex 0.14.0, “mysql2”: “1.4.2”
Issue Analytics
- State:
- Created 6 years ago
- Comments:44 (15 by maintainers)
Top Results From Across the Web
Can't add new command when connection is in closed state
I am using the Amazon EC2 with Ubuntu. I am running the server using the PM2, as pm2 start bin/www --log-date-format "YYYY-MM-DD ...
Read more >Error: Can't add new command when connection is in closed ...
{ Error: Can't add new command when connection is in closed state at PoolConnection._addCommandClosedState. I use mysql 2 and connect Pool.
Read more >Can't add new command when connection is in closed state ...
I had a similar problem and ended up having to put the connection request in it's own .js file and import it into...
Read more >Can't add new command when connection is in closed state
Node+Express+MySQLを使ってデータ取得時に2回目から以下のエラーが発生しましたので、原因と解決…
Read more >connection lost nodejs, node-mysql connection close, can 't ...
can 't add new command when connection is in closed state. I solved my problem by just closing the connection after 10 seconds...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, just today we’ve observed (by placing a few good ol’
console.logs) that thefactory.validatefunction whichknex.jsprovides togeneric-poolis never called, which might explain how already-dead connections are still being dispensed from the resource pool. Supposedly,generic-poolwill validate resources before dispensing, and if they seem broken, create and dispense a new one (in this case, connection) as a replacement. However, this only happens if the right options are passed togeneric-pool: https://github.com/coopernurse/node-pool/blob/master/lib/Pool.js#L222As seen in the code above, the pool will only actually run the validator function if the option
testOnBorrowhas been enabled. It is false by default, and knex.js does not seem to override it when creating the pool.@rkaw92 I am testing this workaround since yesterday morning and it seems to work fine. Before that I had to restart API processes at least once a day, otherwise database connection will eventually close without reconnection.