Fail fast if the template process dies during dmtcp_restart#7
Open
gc00 wants to merge 1 commit into
Open
Conversation
When model checking from a checkpoint, multithreaded_fork_process_source launched dmtcp_restart and then blocked on the readiness semaphore via a plain sig_semwait. If the restarted template process died before signaling readiness -- a corrupt or incompatible checkpoint, or any crash during restore -- mcmini hung forever with no diagnostic: SIGCHLD is not guaranteed to reach us (dmtcp_restart may reparent the restored process), so the semaphore was never posted and the wait never returned. Poll the readiness semaphore with a 1s timeout and, whenever it hasn't been posted, actively check whether the template process is still alive with waitid(P_PID, ..., WEXITED|WNOHANG|WNOWAIT). If it died, throw process_creation_exception with a clear message instead of blocking. WNOWAIT peeks without reaping, so the process handle's destructor is unaffected. The liveness check also runs after a successful acquire, because the SIGCHLD handler posts the same semaphore on child death -- so a post alone does not imply the template stabilized. This is a general robustness fix (independent of TSAN/DMTCP specifics): the classic fork-from-main path already detects template death via SIGCHLD; the restart path did not. It converts every restart failure from a silent hang into a surfaced error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
In fork_process_source.cpp: "The template process ... was not synchronized with correctly:", it's possible that mtcp_restart crashed before the template process could post. (See the comment in the code.) The result was silent hanging, instead of registering the crash of mtcp_restart. This PR fixes that. It was helpful in development to support TSAN.