-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Implements system signal handling for archiving interruption / termination #22487
base: 5.x-dev
Are you sure you want to change the base?
Conversation
9a75dc0
to
78826a9
Compare
8d19658
to
138b7e8
Compare
a53f679
to
66d7fba
Compare
e467182
to
9e49bbc
Compare
66d7fba
to
ff22f4f
Compare
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.
Nice clean implementation, with good test coverage 👍
plugins/CoreAdminHome/tests/Integration/Commands/RunScheduledTasksProcessSignalTest.php
Show resolved
Hide resolved
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.
Nicely done indeed! The UI test failures are unrelated.
This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers |
This PR was last updated more than one month ago, maybe it's time to close it. Please check if there is anything we still can do or close this PR. ping @matomo-org/core-reviewers |
0a48caf
to
f5dcce5
Compare
f5dcce5
to
5eb27fb
Compare
Description
Provides handling of
SIGINT
andSIGTERM
for bothcore:archive
andscheduled-tasks:run
.SIGINT
When receiving
SIGINT
, the current step in the process (currently running archives, current scheduled task) should be completed and then the command should gracefully stop.SIGTERM
When receiving
SIGTERM
, the archiving tries to stop immediately, based on the current step and system capabilities.Due to the way the default
CliMulti
is implemented, archiving requests made withcurl
orshell_exec
will still be awaited to completion. Archiving tasks run withSymfony/Process
will be killed immediately and the invalidation of those are reset to be picked up in the next archiving run.As scheduled tasks are stopped after the current task is finished, to avoid any timing problems with emails not being sent or being sent too often, or aborted downloads leaving the system in an unplanned state.
Tests
The behaviour of both signals should have full test coverage, documenting and asserting the way invalidations are handled.
As those tests require interaction with background shell processes, they currently use
Symfony/Process
, though a switch toproc_open
is possible.Every step in the tests is safeguarded by timeouts, to not leave zombie processes running if a test fails. For local debugging, depending on where a breakpoint is set (should work through the all shell execution levels), the timeouts can be changed in the implemented
waitForSuccess
helper methods to allow for an indefinite wait. This may require a local process cleanup after the test finishes, as some background tasks (e.g.CliMulti::executeAsyncCli
) are not stopped with the associated test orcore:archive
process.Refs DEV-18318
Review