Skip to content

Stabilize snapshot suspension safety test#12

Merged
IRus merged 3 commits into
mainfrom
fix/snapshot-suspension-safety-jvm-test
Jul 19, 2026
Merged

Stabilize snapshot suspension safety test#12
IRus merged 3 commits into
mainfrom
fix/snapshot-suspension-safety-jvm-test

Conversation

@IRus

@IRus IRus commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

  • wait for the single-thread invocation dispatcher to drain before starting snapshot capture
  • document why observing InHostImport alone does not prove that the host continuation is parked

Root cause

StoreStatus.InHostImport is published before the host coroutine actually suspends and releases the store execution gate. Under CI scheduling, snapshot capture could race that still-running continuation and correctly fail with SnapshotStateException at Store.kt:983.

The dispatcher barrier proves that the prior invocation segment has suspended before capture begins. This changes test synchronization only; runtime behavior remains unchanged.

Validation

  • reproduced the original failure locally with a widened pre-suspension scheduling window
  • verified the forced race passes after the fix
  • ran SnapshotSuspensionSafetyJvmTest 10 times with JDK 17 and CI=true
  • ran the full workflow-equivalent JVM suite successfully (67 tasks)
  • reran the focused test after rebasing onto current main

IRus and others added 3 commits July 19, 2026 10:04
CI run 29678913141 showed suspendedHostImportMayResumeOnAnotherThread
WithoutLosingGuestState resuming on an unexpected thread: InHostImport
is published before the import's continuation actually parks, so a
completion racing that window finishes the await without the intended
thread hop. Poll Store.captureSnapshotState until it stops throwing —
the capture gate can only be acquired once the running segment has
suspended and released the store execution gate — before handing the
result to the resumer thread, mirroring the dispatcher drain the other
test already uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@IRus
IRus marked this pull request as ready for review July 19, 2026 09:34
@IRus
IRus merged commit fcef4f4 into main Jul 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant