Closed pojntfx closed 2 days ago
Hi again @pojntfx, thx for letting us know about this issue, I totally missed the serialization order in the previous PR. The fix you propose in the description is indeed valid and reasons why are in the new PR which is merged now.
Describe the bug
Recently, we reported a bug that lead to ongoing
read
syscalls not being interrupted after a snapshot resume. @ShadowCurse Then published a fix for this. We then verified that their fix worked by using our reproducer repo:https://github.com/firecracker-microvm/firecracker/issues/4736#issuecomment-2347815017
In the reproducer repo, we're essentially doing this:
socat
socat
And this now all works fine now! At step 7, any in-progress reads from the VSock in the guest VM now return RST errors (as they should).
But if we add the following steps:
socat
againsocat
The issue appears again! Essentially, if we create & resume two or more subsequent snapshots (already verified this with upstream Firecracker using our existing reproducer repo), reads from the VSocks don't get any RST errors anymore but instead hang forever.
To Reproduce
See the original reproduction steps, but add the additional steps described above (snapshot & restore more than one time)
Expected behaviour
See the original expected behavior - from our reading, this behavior should continue to work even if it's the 2nd, 3rd etc. snapshot/restore cycle.
Potential Fix
We noticed that in
src/vmm/src/device_manager/persist.rs
, the VSock state is serialized before the reset event is sent. If this is swapped, the issue goes away, and the 2nd, 3rd etc. resume still correctly resets any connected VSocks. We're not sure if this is a proper solution though, if there are any better workarounds or if there is a better way to fix the issue. To test it, apply the following patch:Then run the reproduction steps using the reproducer repo. The issue should no longer appear afterwards.
Environment
6.10.6-200.fc40.x86_64
, guest6.1.89
x86_64
Additional context
See the original additional context.
Checks