RDKEMW-24270:Avoid race condition between memcr and stop cont - #478
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The abort path does not reliably stop in-flight checkpointing before the container is killed.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR addresses a race between container stopping and in-progress hibernation.
Changes:
- Extends stop handling for awakening containers with active hibernation PIDs.
- Adds diagnostic logging for hibernation abort transitions.
| File | Summary |
|---|---|
daemon/lib/source/DobbyManager.cpp |
Updates hibernation abort handling and logging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This reverts commit aea895d.
ks734
approved these changes
Sep 28, 2026
B-Larsen
approved these changes
Oct 2, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



What does this PR change/fix and why?
This PR fixes a race between container stop and in-progress hibernation.
When a container is being hibernated, MEMCR can still hold an active ptrace/seize on the in-flight PID while Dobby is checkpointing it. If a stop request arrives in that window, the code could attempt to kill the container before MEMCR has fully unwound the process, leading to a crash in the restore/checkpoint path.
This change adds a safe abort path for in-flight hibernation:
detect the PID currently being checkpointed
move the container state from Hibernating to Awakening
stop the hibernation loop from continuing
issue WakeupProcess for the active PID
only then continue with the stop path
This prevents a stop/kill from racing the MEMCR restore/checkpoint flow while the PID is still held under ptrace.
Test Procedure
Refer Ticket
Type of Change
Requires Bitbake Recipe changes?
meta-rdk-ext/recipes-containers/dobby/dobby.bb) must be modified to support the changes in this PR (beyond updatingSRC_REV)