Skip to content

setup_builder: wait for non-zero device size before formatting sticky disk - #118

Merged
piob-io merged 1 commit into
mainfrom
devin/1784153513-wait-device-size
Jul 16, 2026
Merged

setup_builder: wait for non-zero device size before formatting sticky disk#118
piob-io merged 1 commit into
mainfrom
devin/1784153513-wait-device-size

Conversation

@piob-io

@piob-io piob-io commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a hot-attach race where mkfs.ext4 fails with Device size reported to be zero right after the sticky-disk response arrives (seen in the staging benchmark run: job thrash-swarm-shared / round2 (pyjobs).

The VM agent hydrates the sticky disk into a pre-attached drive and asks the hypervisor to raise a virtio config-change interrupt; the GetStickyDisk response can reach the runner before the guest kernel has processed that interrupt, so /dev/vdb transiently reports size 0. The same window exists on the direct rbd-nbd hot-patch path, so the fix is guest-side:

setupStickyDisk():
  device = getStickyDisk().device
+ waitForNonZeroDeviceSize(device, 10_000)   // poll `blockdev --getsize64` every 100ms
  maybeFormatBlockDevice(device)             // blkid / resize2fs / mkfs.ext4
  mount(device, mountPoint)

Beyond the mkfs failure, formatting/probing a zero-size view could also misread a warm disk as unformatted, so gating all device access on a non-zero size is the safe ordering. Times out loudly after 10s (observed race window is sub-second). dist/ rebuilt.

Link to Devin session: https://app.devin.ai/sessions/ba61e842e479410d95116fe1dfe77b0f
Requested by: @piob-io


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled. (Staging)

… disk

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@piob-io piob-io self-assigned this Jul 15, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@piob-io
piob-io merged commit 6ff44f8 into main Jul 16, 2026
12 checks passed
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