Skip to content

flake: MicroVM child retained-source test can deadlock during provider handshake #2240

Open

Description

@jbeda

Failure

The race-test CI job for PR #2239 timed out after 10 minutes in internal/app, with TestMicroVMChildRetainsParentSourceAfterRetirement running for 9m26s.

Suspected synchronization race

In internal/app/microvm_harness_context_test.go:374–378, the mock provider observer sends to arrived before incrementing the atomic call counter and deciding whether to wait on resume:

arrived <- req
if calls.Add(1) == 1 {
    <-resume
}

After receiving that arrival, the test retires the parent and starts a second run. It drains that run before closing resume (:395–415).

A possible interleaving is:

  1. The first callback sends its arrival, then is descheduled before incrementing the counter.
  2. The test receives the arrival and starts the second run.
  3. The second callback increments first, gets counter value 1, and waits on resume.
  4. The test waits for the second run to finish before closing resume.

This creates a circular wait. The CI dump is consistent with this: the provider callback is blocked at line 377, while the test is blocked draining the second run at line 404. This interleaving is a diagnosis from the source and stack dump, not a locally reproduced trace.

Local verification

Fifty focused repetitions with race detection passed:

GOWORK=off go test -mod=readonly -race ./internal/app \
  -run '^TestMicroVMChildRetainsParentSourceAfterRetirement$' \
  -count=50 -timeout=60s

The intermittent behavior appears scheduling-dependent, rather than a normal slow-test timeout.

Suggested fix and acceptance

  • Establish which callback owns the pause before signaling arrival, so the second run cannot become the paused first callback.
  • Keep the real parent-retirement and retained-source behavior under test; do not weaken it or merely increase the suite timeout.
  • Make handshake failures bounded and diagnostic, with cleanup that releases paused callbacks.
  • Add a deterministic regression for the problematic handoff and run repeated race tests plus the package integration boundary.

Activity

  1. added
    bug
    flake
    on Oct 9, 2026
  2. asivanadi0 commented on Oct 15, 2026

    @asivanadi0

    I’d like to work on this issue. My proposed scope is to establish pause ownership before signaling arrival, add bounded waits and cleanup, and add deterministic regression coverage while preserving the retained-source assertions. I’ll validate with repeated race tests and the package integration tests.

    Could you assign this to me?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugciflake

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions