Connection lost to MySQL server #558

Closed
wstucco opened this Issue Feb 27, 2014 · 7 comments

Projects

None yet

3 participants

@wstucco
Contributor
wstucco commented Feb 27, 2014

When the app is idle, it happens that the connection to MySQL server is lost and I have to restart it to make it work again.
This is the message in the error log

Error: Connection lost: The server closed the connection. at Protocol.end (<project>\node_modules\mysql\lib\protocol\Protocol.js:78:13) at Socket.onend (stream.js:79:10) at Socket.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickDomainCallback (node.js:459:13)

I can't really reproduce the bug, but I'm sure about a couple of things:

  • it happens during the night or in the weekends (idle app)
  • it doesn't happen if the app is launched in development mode, with no workers and no cluster
Contributor
mde commented Feb 28, 2014

We had a PR a while back that was supposed to have improved this situation: geddy/model#164

I believe the fix is only in master -- if it's a serious problem, we can look at cherry-picking it into the release branch.

hazam commented Feb 28, 2014

I also encountered this issue - it locks up the server completely, forces restart :/

Contributor
mde commented Mar 1, 2014

The fix for this has been pushed out to NPM -- model v0.5.7. Update your deps and you should pick up this fix. Let me know how it works for you.

hazam commented Mar 3, 2014

Hello mde,
the fix pushed to 0.5 branch doesn't compile (reconnectattempts undeclared)
(Probably a mistake in cherry-pick from edencore:master)
https://github.com/geddy/model/blob/v0.5/lib/adapters/sql/mysql.js

This means that current geddy 0.12.5 (depending on model 0.5.7) crashes with mysql adapter.

All this IMHO, i'm kind of newbie in GitHub and Geddy.

(fix in master looks ok https://github.com/geddy/model/blob/master/lib/adapters/sql/mysql.js)

Contributor
mde commented Mar 3, 2014

Yes, probably bad conflict resolution from the cherry-pick. I've fixed this, added an actual test, and pushed it out to NPM, Model v0.5.8. Thanks for your patience.

@mde mde closed this Mar 3, 2014
hazam commented Mar 4, 2014

Unfortunately the fix is unsuccessful. Same problem, after around 12+ hours of inactivity, mysql adapter faults same way when server closes the connection.

hazam commented Mar 5, 2014

Actually, problem is not bound to inactivity. Even pinging DB every hour (through geddy/model obviously) doesnt' fix.

Any pointers? At the moment, I cannot keep my Geddy / MySQL server in production, it just keeps crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment