Skip to content

fix: prevent sticky disk commit after buildkitd SIGKILL#77

Merged
adityamaru merged 1 commit intomainfrom
fix/sigkill-sticky-disk-commit
Mar 25, 2026
Merged

fix: prevent sticky disk commit after buildkitd SIGKILL#77
adityamaru merged 1 commit intomainfrom
fix/sigkill-sticky-disk-commit

Conversation

@adityamaru
Copy link
Copy Markdown
Contributor

@adityamaru adityamaru commented Mar 25, 2026

Closes #68.

The sigkillUsed flag was written with core.saveState but read with core.getState. These two functions communicate via the GITHUB_STATE file and STATE_* environment variables respectively — a channel that only works between the main step and post-job step. Since both setSigkillUsed(true) (in the SIGKILL path of shutdownBuildkitd) and getSigkillUsed() (in the sticky-disk commit guard) run inside the same post-job process, the flag was always false, and sticky disks were committed even after a forced kill.

How it works:

  • A module-level _sigkillUsed variable in state-helper.ts now tracks the flag in-memory. setSigkillUsed sets both the variable and core.saveState (belt-and-suspenders). getSigkillUsed reads the variable first, falling back to core.getState for any future cross-step use.
  • The unconditional core.info("Shutdown buildkitd gracefully") log after shutdownBuildkitd() returns is now gated on getSigkillUsed(), so it won't misleadingly print after a SIGKILL termination.

The change is confined to two files (state-helper.ts, main.ts) and has no effect on the happy path — the in-memory variable defaults to false, matching the previous behavior when SIGKILL isn't used. The dist/ bundle will need a CI rebuild.


View Codesmith session


Open with Devin

Add an in-memory _sigkillUsed flag alongside the existing core.saveState
persistence. This ensures getSigkillUsed() returns true within the same
process even if the GitHub Actions state mechanism has issues during
post-action cleanup.

Also log a warning (instead of the misleading 'gracefully') when
buildkitd was actually terminated with SIGKILL.

Co-authored-by: Codesmith <codesmith@blacksmith.sh>
@adityamaru adityamaru force-pushed the fix/sigkill-sticky-disk-commit branch from d5c25ac to e75024e Compare March 25, 2026 14:32
@adityamaru adityamaru requested a review from eltonkl March 25, 2026 14:42
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@adityamaru adityamaru merged commit a483dff into main Mar 25, 2026
10 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.

Contradictory output on shutdown; sticky disk committed even after forceful termination of buildkitd

2 participants