Skip to content

fix: use atomic rename in setup_subprocess_double_fork test#2815

Merged
markphelps merged 2 commits intomainfrom
fix/flaky-setup-subprocess-double-fork
Mar 30, 2026
Merged

fix: use atomic rename in setup_subprocess_double_fork test#2815
markphelps merged 2 commits intomainfrom
fix/flaky-setup-subprocess-double-fork

Conversation

@bfirsh
Copy link
Copy Markdown
Member

@bfirsh bfirsh commented Mar 5, 2026

Summary

  • Fixes a race condition in the setup_subprocess_double_fork integration test that causes flaky CI failures
  • The forked child process was writing .outbox directly, allowing the predictor to observe the file (via os.path.exists) before content was fully flushed — resulting in "output":"" instead of the expected value
  • Uses atomic write pattern: write to .outbox.tmp first, then os.rename() to .outbox, so the predictor never reads a partially-written file

…t race condition

The forked child process writes .outbox directly, which means the
predictor can observe the file (via os.path.exists) before the content
is fully flushed. Write to .outbox.tmp first, then os.rename() to
.outbox so the predictor never reads a partially-written file.
@bfirsh bfirsh requested a review from a team as a code owner March 5, 2026 03:53
@michaeldwan michaeldwan added this to the 0.18.0 milestone Mar 5, 2026
@michaeldwan michaeldwan added this pull request to the merge queue Mar 23, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 23, 2026
@markphelps markphelps added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit fd53328 Mar 30, 2026
32 checks passed
@markphelps markphelps deleted the fix/flaky-setup-subprocess-double-fork branch March 30, 2026 18:21
markphelps added a commit that referenced this pull request Mar 30, 2026
….com/replicate/cog into mp/fix/dict-list-output-schema-fixes

* 'mp/fix/dict-list-output-schema-fixes' of https://github.com/replicate/cog: (44 commits)
  bonk code reviews (#2892)
  fix: clarify env variable deny-list error message (#2813)
  fix: use atomic rename in setup_subprocess_double_fork test to prevent race condition (#2815)
  chore(deps): bump github.com/docker/cli (#2885)
  chore(deps): bump ureq from 3.2.0 to 3.3.0 in /crates (#2888)
  docs: fix HTTP discovery endpoint response to match Rust implementation (#2883)
  fix: support PEP 604 unions in File/Path coercion detection (#2878)
  fix: remove mise python venv config to silence warnings (#2879)
  refactor: extract homebrew tap into standalone reusable workflow (#2881)
  chore: 0.17.1 (#2877)
  review: replace string tags with FieldKind enum, add Debug derives, remove redundant test assertion (#2874)
  fix: app id in release workflow for homebrew tap (#2875)
  fix: don't coerce URL strings in str-typed inputs (regression #2868) (#2872)
  use GHCR mirror for cog-base images in integration tests (#2866)
  docs: improve documentation for input/output types (#2864)
  add workflow to mirror cog-base images from r8.im to GHCR (#2871)
  fix: bound fuzz tree size to prevent CI timeout in FuzzJSONSchema
  fix: guard against slice panic on single-char quoted strings in parseTypeFromString
  fix: address review issues in static schema generation
  Bump version to 0.17.0
  ...
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.

3 participants