mysql - Google Cloud SQL No Response -


we running sails.js api on google container engine cloud sql database , we've been finding of our endpoints have been stalling, never sending response.

i had health check monitoring /v1/status , registered 100% uptime when had following simple response;

status: function( req, res ){     res.ok('welcome api');        } 

as added database query, endpoint started timing out. doesn't happen time, seemingly @ random intervals, hours on end. have changed query to;

status: function( req, res ){     email.findone({ value: "someone@example.com" }).then(function( email ){         res.ok('welcome api');     }).fail(function(err){         res.servererror(err);     }); } 

rather suspiciously, works fine in our staging , development environments, it's when code deployed in production timeout occurs , it occurs of time. thing changes between staging , production database connecting , load on server.

as mentioned earlier using google cloud sql , sails-mysql adapter. have following error stacks production server;

adaptererror: invalid connection name specified @ getconnectionobject (/app/node_modules/sails-mysql/lib/adapter.js:1182:35) @ spawnconnection (/app/node_modules/sails-mysql/lib/adapter.js:1097:7) @ object.module.exports.adapter.find (/app/node_modules/sails-mysql/lib/adapter.js:801:16) @ module.exports.find (/app/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:120:13) @ module.exports.findone (/app/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:163:10) @ _runoperation (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:408:29) @ run (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:69:8) @ bound.module.exports.findone (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/basic.js:78:16) @ bound [as findone] (/app/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21) @ deferred.exec (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/deferred.js:501:16) @ trycatcher (/app/node_modules/sails/node_modules/waterline/node_modules/bluebird/js/main/util.js:26:23) @ ret (eval @ <anonymous> (/app/node_modules/sails/node_modules/waterline/node_modules/bluebird/js/main/promisify.js:163:12), <anonymous>:13:39) @ deferred.topromise (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/deferred.js:510:61) @ deferred.then (/app/node_modules/sails/node_modules/waterline/lib/waterline/query/deferred.js:521:15) @ strategy._verify (/app/api/services/passport.js:31:7) @ strategy.authenticate (/app/node_modules/passport-local/lib/strategy.js:90:12) @ attempt (/app/node_modules/passport/lib/middleware/authenticate.js:341:16) @ authenticate (/app/node_modules/passport/lib/middleware/authenticate.js:342:7) @ object.authcontroller.login (/app/api/controllers/authcontroller.js:119:5) @ bound (/app/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21) @ routetargetfnwrapper (/app/node_modules/sails/lib/router/bind.js:179:5) @ callbacks (/app/node_modules/sails/node_modules/express/lib/router/index.js:164:37) 

error (e_unknown) :: encountered unexpected error :  not connect mysql: error: pool closed. @ afterwards (/app/node_modules/sails-mysql/lib/connections/spawn.js:72:13) @ /app/node_modules/sails-mysql/lib/connections/spawn.js:40:7 @ process._tickdomaincallback (node.js:381:11) 

looking @ errors alone, i'd tempted have misconfigured. fact works of time (and has been working fine!) leads me believe there's other black magic @ work here. our cloud sql instance d0 (though we've tried upping size d4) , our activation policy "always on".

edit: had seen others complain google cloud sql eg. this post , suspicious have since moved our database amazon rds , still seeing same issues, must problem sails , mysql adapter.

this issue leading hours of downtime day, need resolved, appreciated!

this appears sails issue, , not related cloud sql.


Comments