Reduce likelihood of timeout/signal related race condition - #476
Open
LudovicoRighi wants to merge 4 commits into
Open
Reduce likelihood of timeout/signal related race condition#476LudovicoRighi wants to merge 4 commits into
LudovicoRighi wants to merge 4 commits into
Conversation
LudovicoRighi
force-pushed
the
no-process-error
branch
3 times, most recently
from
July 10, 2025 12:40
38459c5 to
a307137
Compare
LudovicoRighi
force-pushed
the
no-process-error
branch
from
July 10, 2025 12:41
a307137 to
ee12f62
Compare
agent error response to message: no process
LudovicoRighi
marked this pull request as ready for review
July 10, 2025 16:13
Contributor
|
Is there a way you can make |
Collaborator
Author
|
Sounds good; I've opened apsis-scheduler/procstar#62. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary: there is a race condition (i.e. trying to send a signal to a process which doesn't exist anymore) in Procstar; this PR helps to make that race less likely, but won't fix it completely. More details below.
The race condition
AgentMessageError: agent error response to message: no process..see the
killfunctionI think this race condition could be fixed by using a locking mechanism between:
wait_for_procsend_signal(or maybekillfunction itself)Ideally, rather than blindly trying to send the signal and then erroring with
no process, we should rather ensure the process is still around before sending the signal and only log something likeprocess already terminated: not sending the signal.(Not sure if there's also the risk that we kill another process which may have started with the same PID, haven't double checked yet).
The change
The idea of this change is to cancel the timeout task as soon as the update regarding the process termination is received.
This should help to reduce the likelihood of the issue explained above:
Issue reproduction:
Notice that running the test I've added against
masterbranch helps to reproduce theAgentMessageErrorconsistently.