Skip to content

RDKEMW-24270:Avoid race condition between memcr and stop cont - #478

Merged
B-Larsen merged 4 commits into
release/v3.19from
topic/RDKEMW-24270
Oct 2, 2026
Merged

B-Larsen merged 4 commits into
release/v3.19from
topic/RDKEMW-24270

Conversation

@Sonajeya31

@Sonajeya31 Sonajeya31 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (doesn't fit into the above categories - e.g. documentation updates)

Requires Bitbake Recipe changes?

  • The base Bitbake recipe (meta-rdk-ext/recipes-containers/dobby/dobby.bb) must be modified to support the changes in this PR (beyond updating SRC_REV)

Copilot AI lite review requested due to automatic review settings September 24, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity

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.

Comment thread daemon/lib/source/DobbyManager.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Container identity must be revalidated after reacquiring the lock to avoid stopping a replacement container.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread daemon/lib/source/DobbyManager.cpp Outdated
This reverts commit aea895d.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The stop path can issue a duplicate concurrent restore, and the new race handling lacks regression coverage.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
Resolved since last review (1)

Comment thread daemon/lib/source/DobbyManager.cpp
Comment thread daemon/lib/source/DobbyManager.cpp
Comment thread daemon/lib/source/DobbyManager.cpp
Comment thread daemon/lib/source/DobbyManager.cpp
@B-Larsen
B-Larsen merged commit 9974ec3 into release/v3.19 Oct 2, 2026
40 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants