Open cope opened 5 years ago
@cope Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
Please read the errors first, the issues might be here you don't have the mongo plugin instaled in your project
@cope To confirm, does this work & connect if you remove reconnectTries
?
@johnabrams7 yes, I just did. But, as soon as this error happens, no more reconnect.
error: Error occurred in session middleware :: 'MongoError: no connection available for operation\n at Function.MongoError.create (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb-core\lib\error.js:31:11)\n at Store.flush (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb\lib\topology_base.js:68:43)\n at Server.destroyHandler (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb\lib\server.js:258:18)\n at Object.onceWrapper (events.js:315:30)\n at emitOne (events.js:116:13)\n at Server.emit (events.js:211:7)\n at Server.destroy (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb-core\lib\topologies\server.js:673:24)\n at reconnectServer (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb-core\lib\topologies\server.js:162:17)\n at Timeout._onTimeout (C:\git\systools\myapp\node_modules\connect-mongo\node_modules\mongodb-core\lib\topologies\server.js:272:7)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)' WebSocket client disconnected. qMJ2lIHfjxexExOuAAAB
@cope Interesting, if it's giving an error either way - there may be another factor involved. Could you make a minimal Sails 0.12x repo that reproduces this issue?
Node version: v8.15.0 Sails version (sails): 0.12.14 ORM hook version (sails-hook-orm): 1.0.9 Sockets hook version (sails-hook-sockets): 0.13.14 Organics hook version (sails-hook-organics): - Grunt hook version (sails-hook-grunt): - Uploads hook version (sails-hook-uploads): - DB adapter & version (e.g. sails-mysql@5.55.5): - Skipper adapter & version (e.g. skipper-s3@5.55.5): 0.7.6
I added autoReconnect and auto_reconnect, based on some issues and pull request comments I found, and I also added reconnectTries - tried with both Number.MAX_VALUE and 1000000 - but no matter what, it still does not reconnect when mongo is restarted :(
I think the error I get may shed some light:
error: Error occurred in session middleware :: 'MongoError: no connection available for operation\n at Function.MongoError.create (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb-core\\lib\\error.js:31:11)\n at Store.flush (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb\\lib\\topology_base.js:68:43)\n at Server.destroyHandler (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb\\lib\\server.js:258:18)\n at Object.onceWrapper (events.js:315:30)\n at emitOne (events.js:116:13)\n at Server.emit (events.js:211:7)\n at Server.destroy (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb-core\\lib\\topologies\\server.js:673:24)\n at reconnectServer (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb-core\\lib\\topologies\\server.js:162:17)\n at Timeout._onTimeout (C:\\git\\systools\\myapp\\node_modules\\connect-mongo\\node_modules\\mongodb-core\\lib\\topologies\\server.js:272:7)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)'
Particularly the
at Server.destroy
part... I guess the server is shutting down, but I don't know why?