-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: don't report SIGTERM & friends to Sentry #587
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
70ae8ef
fix: don't report SIGTERM & friends to Sentry
bajtos fb69a00
Merge branch 'main' into ignore-zinnia-sigterm-exit
bajtos b07f6b9
fixup! bring back "throw err", don't throw on SIGTERM
bajtos 1d1eacb
fixup! throw on AbortError
bajtos 5df27aa
Merge branch 'main' into ignore-zinnia-sigterm-exit
bajtos 8beba55
Merge branch 'main' into ignore-zinnia-sigterm-exit
bajtos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Have you verified that Core properly shuts down here?
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 does not shut down, it restarts the Zinnia.
I'll double check this is still true.
Or did you mean something else?
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.
Ah right! Yeah would be great if you could double check this behavior
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.
Test scenario:
npm test
in one terminal tabkillall zinniad
in the second tabConsole output from Station Core - the version from the
main
branch (e895f0b):Console output from Station Core - the version from this pull request (5df27aa):
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.
In both cases, Zinnia restarts.
When I run
npm start
and thenkill <pid>
, Station Core exits immediately without logged messages. I think that's because Station Core does not implement custom handling of SIGTERM/SIGINT signals.The remaining question is what happens when the auto-updater kicks in and asks Zinnia to exit the process so that we can install the new version. I think this should be fine because we restart the main loop regardless of whether the child process exited or crashed.
https://github.com/filecoin-station/core/blob/e895f0be37f9fe8c0967b9d4048cd20c260e8419/lib/zinnia.js#L300-L321
@juliangruber do you know how can I test this?
I tried the following change:
try { await Promise.all([ + timers.setTimeout(5_000).then(() => { console.log('FORCED RESTART'); controller.abort() }), runUpdateSourceFilesLoop({ controller, signal, onActivity, moduleVersionsDir, moduleSourcesDir }), catchChildProcessExit({ childProcesses, onActivity, controller }) ]) console.error('Zinnia main loop ended')
Console log from running this version:
Based on the above, I think my change is safe to land.
I also think it's Station Core that kills Zinnia using SIGTERM, but then in the "exit/crash handler" does not realise it was us 🤷🏻
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.
Another possible improvement:
What to consider: We trigger a Zinnia restart when the module does not log any message in 5 minutes. The restart is triggered via the abort signal.
I think this part of the codebase is becoming too difficult to reason about. Unfortunately, I don't have the bandwidth to refactor it for more clarity.
Therefore, I propose to land my pull request as-is to prevent Station Core from creating Sentry issues when the auto-updater kills the module processes and defer any further improvements until there is more pressing need for them.
This comment was marked as resolved.
Sorry, something went wrong.