node.js - Node JS Mysql PROTOCOL ENQUEUE AFTER FATAL ERROR -


what dose error means?

this code works in test file.

function handledisconnect() {     objconn = mysql.createconnection(db_config);    // recreate connection, since                                                     // old 1 cannot reused.     objconn.connect(function(err) {                 // server either down         if(err) {                                   // or restarting (takes while sometimes).             console.log('error when connecting db:', err.code);             settimeout(handledisconnect, 2000);     // introduce delay before attempting reconnect,         }else{             console.log('connected db!');         }                                           // avoid hot loop, , allow our node script     });                                             // process asynchronous requests in meantime.                                                     // if you're serving http, display 503 error.     objconn.on('error', function(err) {         if(err.code === 'protocol_connection_lost') { // connection mysql server             handledisconnect();                       // lost due either server restart, or         }else{             throw err;         }     }); }  handledisconnect(); megaloop();  function megaloop(){     objconn.query('select u.`email` `users` u', function(err, rows) {         console.log(err);         console.log(rows);     });     settimeout(megaloop, 100);  } 

but when use function in express app error.

{ [error: cannot enqueue query after fatal error.] code: 'protocol_enqueue_after_fatal_error', fatal: false } 

so question have dose error mean? , way dose work in test , not app?

i believe issue express-sql-session. i'm experiencing same issue right now. think on @ post: nodejs running on mac, , have error occurred when deploying on centos

check out too: https://github.com/felixge/node-mysql/issues/1166


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -