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
Reconnect to mysql on disconnect or error #2323
Comments
Which knex version are you using? Pool reconnecting after connection failure was improved in 0.14. There is no special method / event for being able to handle this error. |
Ok ok that's great I will give it a try, we were using the last 0.12.9 version |
@elhigu Hi! Stack trace example:
Update: Just in case, my knex settings:
|
@treble-snake Taking a shot out of the blue here, but given that this seems to be Pool issues, could you try to append knex({
connection: {...},
pool: {
evictionRunIntervalMillis: 1000
},
}); The upgrade of pool library could have more unexpected consequences than discovered in #2322. |
@elhigu
|
Btw, is it possible to retrieve connection object in order to inject log statement like this one? |
@elhigu |
We have noticed the same error ( |
It seems to be the same for @NemoAlex #452 (comment). |
I've just performed some tests and can confirm it's reproducible.
Same steps work OK (reconnect with no error) with knex 0.13.0. @wubzz I've tried adding But I guess some other cases than MySQL server restarting can also lead to that error, 'cause I most certainly haven't restarted remote MySQL server, but got the same error there. Knex config:
|
@ammar08429 I'd suggest you use 0.13.0 version for now, it seems more stable |
@treble-snake I'm fixing some new pool problems to 0.14.1 |
@elhigu Please Re-open this issue |
@ammar08429 I though this was a duplicate of #2321 but looks like error message is a bit different. Better to reopen to make sure that this get fixed too. |
+1 on the same situation in 0.14.0 |
Please test this with 0.14.1 and lets reopen if there are still problems. |
Simple scenario with server's restarting seems to be fixed. |
Simple restart is working right now |
If the MySQL server goes down, or it down scales or something
the previous connection of the application server with MySQL get corrupted and the server starts throwing this issue
PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR Cannot enqueue Query after fatal error
We face multiple errors in such scenarios, In the docs, I couldn't find anything regarding reconnecting the only solution that we have is restarting the service?
I would like to know that, do you have anything
like
reconnectTries
,reconnectInterval
like other libraries like this mongo library has
The text was updated successfully, but these errors were encountered: