Skip to content

[live-migration] harden resume against stdio and exit wait loss - #2866

Open
Harsh Rawat (rawahars) wants to merge 3 commits into
microsoft:mainfrom
rawahars:source-rollback-reconnect
Open

[live-migration] harden resume against stdio and exit wait loss#2866
Harsh Rawat (rawahars) wants to merge 3 commits into
microsoft:mainfrom
rawahars:source-rollback-reconnect

Conversation

@rawahars

@rawahars Harsh Rawat (rawahars) commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Two blackout-related gaps in live migration, each restoring behavior the connection drop had broken:

  • Container stdio on source rollback — on rollback the VM resumes on source but the container's stdout/stderr, dropped during blackout, were never restored. Resume now brings those streams back the same way the destination already does, so a rolled-back container keeps streaming its output as if the migration had never been attempted.
  • Process exit reported after blackout — a process reopened on the destination relies on the exit wait its previous owner left outstanding in the guest. If it exited while no bridge was connected that response was lost, so the reopened process waited for an exit that was never reported. Reopen now probes with a short bounded wait: an already-exited process returns its retained exit code immediately, while a still-running one lets the probe time out and the outstanding wait is watched as before.

Testing

Ran live-migration source rollback with a single container and with 10 containers; validated logs stream back on the source.

@rawahars
Harsh Rawat (rawahars) requested a review from a team as a code owner August 9, 2026 09:09
When a live migration rolls back to the source, the VM resumes but the
container's stdout/stderr were dropped during blackout and never restored,
so anything watching the container's output saw it stop for good.

Resume now brings those streams back the same way the destination already
does, so a rolled-back container keeps streaming its output as if the
migration had never been attempted.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
A process reopened on the destination relies on the exit wait its previous
owner left outstanding in the guest. If the process exited while no bridge
was connected, the guest's response to that wait was dropped and never
re-sent, so the reopened process would wait for an exit that is never
reported.

On reopen, probe with a short bounded wait: an already-exited process
returns its retained exit code immediately, while a still-running one lets
the probe time out and the outstanding wait is watched as before.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars Harsh Rawat (rawahars) changed the title [live-migration] restore container stdio on source rollback [live-migration] harden resume against stdio and exit wait loss Aug 9, 2026
Comment thread internal/gcs/bridge.go
if existing, dup := brdg.rpcs[id]; dup {
// A source rollback re-opens a process whose wait is still outstanding;
// hand back that call.
return existing, nil

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.

PreregisterRPC returns the existing call for a duplicate ID, but OpenProcessWithIO keeps the new Process.waitResp. The existing call still unmarshals into the old response object. I reproduced this on the combined #2867 + #2866 branch: completing the reused wait with exit code 42 made the new Process.ExitCode() return 0. Can we preserve the response object together with the reused call, and add that case to the test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. Addressed the same in db73516

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>

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.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants