Skip to content
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

Error: User.getUser failed with sql errors #24

Open
faktaochkunskap opened this issue Mar 30, 2015 · 4 comments
Open

Error: User.getUser failed with sql errors #24

faktaochkunskap opened this issue Mar 30, 2015 · 4 comments

Comments

@faktaochkunskap
Copy link

This is the second time I have this error. It seems to happen after a while. Under development I am using forever with no time settings. So maybe something has stopped running. The front-end is still working.

If I restart forever the problem is solved.

Error: User.getUser failed with sql errors
at Query._callback (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:78:46)
at Query.Sequence.end (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at Protocol._validateEnqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:218:6)
at Protocol._enqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:129:13)
at Connection.query (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/Connection.js:185:25)
at Controller.query (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/Controller.js:404:19)
at Function.User.getUser (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:77:16)
at Controller.LoginController.tryLogin (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:90:13)
at Controller.LoginController.doRequest (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:50:10)
at Application.handToController (/home/billgates/Dokument/ipro5/node_modules/cody/apps/Application.js:308:14)

@faktaochkunskap
Copy link
Author

Forever log:

  • ------------------------------------------------------------------- Mon Mar 30 2015 06:14:42 GMT+0200 (CEST)--
  • servePage - path -> /en/login
    buildContext -> page -> en/2 - Login
    servePage - params ->
    { request: 'login', username: 'super', password: 'empty' }
    servePage - session ->
    { cookie:
      { path: '/',
        _expires: Mon Mar 30 2015 07:08:50 GMT+0200 (CEST),
        originalMaxAge: 3600000,
        httpOnly: true },
     pendingContext:
      { params: {},
        path:
         { language: 'en',
           domain: 'dashboard',
           request: '',
           id: '',
           path: 'en/dashboard',
           pagelink: 'en/dashboard',
           link: '/en/dashboard' },
        request: '',
        static: '/static',
        dynamic: '/data',
        fn: '-/cms/dashboard.ejs' },
     login: {} }
    servePage - files ->
    {}
    handToController -> LoginController
    LoginController.constructor -> page(2) = Login, request = login
    Controller.constructor -> page(2) = Login, request = login
    Application.getConnection -> Returning existing connection
    { [Error: Cannot enqueue Query after fatal error.] code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR', fatal: false }
    Error: User.getUser failed with sql errors
       at Query._callback (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:78:46)
       at Query.Sequence.end (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
       at Protocol._validateEnqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:218:6)
       at Protocol._enqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:129:13)
       at Connection.query (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/Connection.js:185:25)
       at Controller.query (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/Controller.js:404:19)
       at Function.User.getUser (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:77:16)
       at Controller.LoginController.tryLogin (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:90:13)
       at Controller.LoginController.doRequest (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:50:10)
       at Application.handToController (/home/billgates/Dokument/ipro5/node_modules/cody/apps/Application.js:308:14)

@jcoppieters
Copy link
Owner

Hello,

I’m afraid you’ll have to do a sudo there…
the problem is that mysql times out and that the connection is unilaterally closed by the server, so you end up with a dead socket…

I’m sure someone can fix this, but I came with this quick fix and let’s be honest: if you site isn’t used for 200 days….

I changed my mySQL config file

vi /etc/mysql/my.cnf # add
[client]
default-character-set=utf8
[myslqd]
collation_server=utf8_unicode_ci
character_set_server=utf8
wait_timeout = 31536000
interactive_timeout = 31536000

Johan.

On 30 Mar 2015, at 06:38, faktaochkunskap notifications@github.com wrote:

Forever log:

------------------------------------------------------------------- Mon Mar 30 2015 06:14:42 GMT+0200 (CEST)--
servePage - path -> /en/login buildContext -> page -> en/2 - Login servePage - params -> { request: 'login', username: 'super', password: 'empty' } servePage - session -> { cookie: { path: '/', _expires: Mon Mar 30 2015 07:08:50 GMT+0200 (CEST), originalMaxAge: 3600000, httpOnly: true }, pendingContext: { params: {}, path: { language: 'en', domain: 'dashboard', request: '', id: '', path: 'en/dashboard', pagelink: 'en/dashboard', link: '/en/dashboard' }, request: '', static: '/static', dynamic: '/data', fn: '-/cms/dashboard.ejs' }, login: {} } servePage - files -> {} handToController -> LoginController LoginController.constructor -> page(2) = Login, request = login Controller.constructor -> page(2) = Login, request = login Application.getConnection -> Returning existing connection { [Error: Cannot enqueue Query after fatal error.] code: 'PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR', fatal: false } Error: User.getUser failed with sql errors at Query._callback (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:78:46) at Query.Sequence.end (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24) at Protocol._validateEnqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:218:6) at Protocol._enqueue (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/protocol/Protocol.js:129:13) at Connection.query (/home/billgates/Dokument/ipro5/node_modules/cody/node_modules/mysql/lib/Connection.js:185:25) at Controller.query (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/Controller.js:404:19) at Function.User.getUser (/home/billgates/Dokument/ipro5/node_modules/cody/models/User.js:77:16) at Controller.LoginController.tryLogin (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:90:13) at Controller.LoginController.doRequest (/home/billgates/Dokument/ipro5/node_modules/cody/controllers/LoginController.js:50:10) at Application.handToController (/home/billgates/Dokument/ipro5/node_modules/cody/apps/Application.js:308:14)

Reply to this email directly or view it on GitHub #24 (comment).

@ticup
Copy link
Collaborator

ticup commented Apr 24, 2015

@jcoppieters Should we add this in the default config file? Or maybe it's better to try to open the connection whenever we encounter a dead one?

@ticup ticup added the bug label Apr 24, 2015
@jcoppieters
Copy link
Owner

Problem is solvable

  • easy: set longer timeout for mysql. It happens only on very very low traffic sites (no requests in more than a day). by setting a longer timeout, you can go up to 200days without a request. It is something the mysql user should do, we can't do it in Cody / node.js
  • normal: ping the mysql server once every 6 hours or so. (SetInterval ?)
  • hard: check if the socket to mysql is still open before every query. Feasable, but I think this should be done in the mysql-node implementation, not in Cody.

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

No branches or pull requests

3 participants