FinalsClub / MIT-Annotation-Data-Store

Data Store for Annotation Studio
GNU General Public License v2.0
0 stars 0 forks source link

Crash on database connection failure #2

Open atrigent opened 10 years ago

atrigent commented 10 years ago

There's not much the data store API can do without a database connection, and some connection errors (authentication failure, for example) are pretty much unrecoverable. For the ones that are recoverable, we can rely on Heroku's automatic restarting of the app.

atrigent commented 10 years ago

Also: without change e3893cba6e0d754a57548554371c6511130e1908, some types of connection errors (if I disable my wifi, for example) cause the app to crash with this error:

14:32:59 web.1  | events.js:72
14:32:59 web.1  |         throw er; // Unhandled 'error' event
14:32:59 web.1  |               ^
14:32:59 web.1  | Error: failed to connect to [****.mongolab.com:****]
14:32:59 web.1  |     at null.<anonymous> (/home/atrigent/programming/finalsclub/MIT-Annotation-Data-Store/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
14:32:59 web.1  |     at EventEmitter.emit (events.js:106:17)
14:32:59 web.1  |     at null.<anonymous> (/home/atrigent/programming/finalsclub/MIT-Annotation-Data-Store/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
14:32:59 web.1  |     at EventEmitter.emit (events.js:98:17)
14:32:59 web.1  |     at Socket.<anonymous> (/home/atrigent/programming/finalsclub/MIT-Annotation-Data-Store/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
14:32:59 web.1  | exited with code 8
14:32:59 system | sending SIGTERM to all processes
14:32:59 web.1  |     at Socket.EventEmitter.emit (events.js:95:17)
14:32:59        |     at net.js:833:16
14:32:59        |     at process._tickCallback (node.js:415:13)

Authentication errors, however, do not cause this crash, and there is in fact no indication that they occurred. I'm not sure why. With the above mentioned commit, all connection errors simply produce a console error. This ticket is about making them all crash the app.