Server crashing due to un-handled error?!
iamaldi opened this issue · 5 comments
iamaldi commented
The server log contains an error message:
^Bevents.js:183
throw er; // Unhandled 'error' event
^
Error: Connection lost: The server closed the connection.
at Protocol.end (/home/redacted/the-dream-team/back-end/api/node_modules/mysql/lib/protocol/Protocol.js:113:13)
at Socket.<anonymous> (/home/redacted/the-dream-team/back-end/api/node_modules/mysql/lib/Connection.js:109:28)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Notice the throw er;
error. Looks like a typo somewhere in the code.
TsimpDim commented
Το error είναι πιθανότατα επειδή αυτή τη στιγμή έχουμε μια μόνο σύνδεση που μοιράζονται όλοι, την οποία το mysql module τερματίζει μετά από πολλή ώρα αδράνειας.
Μάλλον πρέπει να στραφούμε σε connection pools τα οποία είναι επί της ουσίας "connections on demand" και είναι αρκετά εύκολα να ενσωματωθούν/υλοποιηθούν στον κώδικα μας.
Έχω παρατηρήσει και άλλες λύσεις τύπου "ας κάνουμε force το mysql να κρατήσει τη συνδεση ανοιχτή χτυπώντας sql αιτήματα κάθε xy χρονικά διαστήματα" αλλά είναι πολύ hacky λύση
TsimpDim commented
Typo δεν είναι γιατί δεν είναι σε δικό μας αρχείο αλλά του node :)
iamaldi commented
Σωστα! Συμφωνώ πως πρέπει να γίνει υλοποιήση mysql pools.
…________________________________
From: Tsimpitas Dimitris <notifications@github.com>
Sent: Thursday, May 10, 2018 9:29:57 AM
To: iamaldi/The-Dream-Team
Cc: Aldi; Assign
Subject: Re: [iamaldi/The-Dream-Team] Server crashing due to un-handled error?! (#38)
Το error είναι πιθανότατα επειδή αυτή τη στιγμή έχουμε μια μόνο σύνδεση που μοιράζονται όλοι, την οποία το mysql module τερματίζει μετά από πολλή ώρα αδράνειας.
Μάλλον πρέπει να στραφούμε σε connection pools<https://github.com/mysqljs/mysql/blob/master/Readme.md#pooling-connections> τα οποία είναι επί της ουσίας "connection on demand" και είναι αρκετά εύκολο να ενσωματωθεί/υλοποιηθεί στον κώδικα μας.
Έχω παρατηρήσει και άλλες λύσεις τύπου "ας κάνουμε force το mysql να κρατήσει τη συνδεση ανοιχτή χτυπώντας sql αιτήματα κάθε xy χρονικά διαστήματα" αλλά είναι πολύ hacky λύση
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#38 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AVyUbgN6SinaqKvXioAPlqfk3COxLDs_ks5tw95lgaJpZM4T5ZN->.
iamaldi commented
Αμα δεις το error, ειναι throw er; ενώ κανονικα πρεπει να ειναι throw err; Αλλα σίγουρα ισχύει αυτο με τον τερματισμό της σύνδεσης απο την υπηρεσία της βάσης.
…________________________________
From: Tsimpitas Dimitris <notifications@github.com>
Sent: Thursday, May 10, 2018 9:31:27 AM
To: iamaldi/The-Dream-Team
Cc: Aldi; Assign
Subject: Re: [iamaldi/The-Dream-Team] Server crashing due to un-handled error?! (#38)
Typo δεν είναι γιατί δεν είναι σε δικό μας αρχείο αλλά του node :)
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#38 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AVyUbkpQqoMfHtII8yoUG3Jqwtf_HnwWks5tw96_gaJpZM4T5ZN->.