-
Notifications
You must be signed in to change notification settings - Fork 1
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
Exit the main process after all closure steps are completed #61
Comments
…losure last step). - Refer to #61. For some reason, there are pending events in the Node Event Loop preventing the process to exit on its own.
- Close ports explicitely. - Log pending handlers and requests in the Event Loop. Reference: nodejs/node#1128 https://github.com/thlorenz/active-handles
Closing all the ports manually, and checking the pending handles and requests in the Event Loop ⌛
=> Moved to #76 |
Avoiding a Premature ExitBefore even adding the listener to the a given closure signal (SIGINT, etc), we execute the following a the end of the main script:
After completing yarp-openmct/iCubTelemVizServer/terminationHandler.js Lines 22 to 27 in b07deb5
...do:
|
… termination after closing all the sockets - Call 'process.exit()' for forcing the process termination. - Refer to #61. For some reason, there are pending events in the Node Event Loop preventing the process to exit on its own.
The Two Main Issues Addressed Here
process.exit()
or any other procedure that we don't want being executed before theterminationHandler
of the main application.process.exit()
.References
Event Loop
https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout
https://nodejs.dev/learn/the-nodejs-event-loop
https://nodejs.dev/learn/understanding-process-nexttick
https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
Avoiding a Premature Exit
terminationHandler
, (d) restore the backuped listeners after completingterminationHandler
. => Exit the main process after all closure steps are completed #62Workaround
process.exit()
after execution of subset C (very last). => Exit the main process after all closure steps are completed #62Further Analysis
Closing all the ports manually (instead of letting the on=> moved to Some pending events are preventing the Telemetry Data Server process to exit on its own #76 .exit
callback do it).Checking the pending handles and requests in the Event Loop.=> moved to Some pending events are preventing the Telemetry Data Server process to exit on its own #76 .The text was updated successfully, but these errors were encountered: