-
Notifications
You must be signed in to change notification settings - Fork 244
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
improvement CLDSRV-466 add timestamp for exceptions #5406
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,10 @@ | ||||||||||||||||||||||
'use strict'; // eslint-disable-line strict | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* Catch uncaught exceptions and add timestamp to aid debugging | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
process.on('uncaughtException', err => { | ||||||||||||||||||||||
process.stderr.write(`${new Date().toISOString()}: Uncaught exception: \n${err.stack}`); | ||||||||||||||||||||||
}); | ||||||||||||||||||||||
Comment on lines
+4
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will change the service behavior in case of error right? Like, we won't crash, and we won't end the current request either, is that what we want? Maybe I'm missing something here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's what I thought too, but from observation he worker still exits after the message is printed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. old PR, but the worker exits because he adds its own listener ( Lines 82 to 91 in 4f7aa54
However the primary (that uses fork and has the monitoring server for prom metrics) don't have another listener, so this is keep the primary up in undefined state if an exception is caught |
||||||||||||||||||||||
|
||||||||||||||||||||||
require('./lib/server.js')(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to also catch the rejections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a long time but this does catch rejections as well