Skip to content

db_store: rebuild from own context when a shared build's owner is cancelled#216

Open
mtelvers wants to merge 1 commit into
ocurrent:masterfrom
mtelvers:fix-dedup-copy-context-cancel
Open

db_store: rebuild from own context when a shared build's owner is cancelled#216
mtelvers wants to merge 1 commit into
ocurrent:masterfrom
mtelvers:fix-dedup-copy-context-cancel

Conversation

@mtelvers

Copy link
Copy Markdown
Member

When two jobs de-duplicate onto one build, the copy step reads the first
caller's build context. If that caller is cancelled and its context deleted
while another job is still sharing the build, the copy fails with ENOENT and
the surviving job fails too, even though it was not cancelled.

This fix flags the build when its context-owning caller is cancelled; a
surviving user then rebuilds from its own context instead of failing. It only
happens on that cancellation, so there is no cost on the normal path.

Two tests are added: a survivor completing after the owner is cancelled
mid-copy, and both jobs being cancelled in turn. Mock_store now removes the
in-progress directory when the build function raises, as the real stores do.

…celled

When two jobs de-duplicate onto one build, the copy step reads the first
caller's build context. If that caller is cancelled and its context deleted
while another job is still sharing the build, the copy fails with ENOENT and
the surviving job fails too, even though it was not cancelled.

Flag the build when its context-owning caller is cancelled; a surviving user
then rebuilds from its own context instead of failing. The flag is per build
record, so ownership cascades: each cancelled owner hands off to a surviving
joiner. Only happens on cancellation, so no cost on the normal path.

Tests: a survivor completes when the owner is cancelled mid-copy; both jobs
cancelled in turn (staggered); and a three-job cascade where the owner and the
new owner are both cancelled and the third still completes. Mock_store now
removes the in-progress directory when the build function raises, as the real
stores do.
@mtelvers mtelvers force-pushed the fix-dedup-copy-context-cancel branch from 9438513 to ce43907 Compare July 13, 2026 07:40
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.

1 participant