Skip to content

fix: serialize browse startup across concurrent clients#301

Closed
malikrohail wants to merge 1 commit intogarrytan:mainfrom
malikrohail:fix/browse-startup-race-lock
Closed

fix: serialize browse startup across concurrent clients#301
malikrohail wants to merge 1 commit intogarrytan:mainfrom
malikrohail:fix/browse-startup-race-lock

Conversation

@malikrohail
Copy link

Summary

  • serialize /browse bootstrap with a cross-process startup lock in the CLI
  • reuse an already-live server instead of racing into a second spawn
  • publish state via per-process temp files and cover the regression with concurrent CLI tests

Verification

  • bun test browse/test/commands.test.ts
  • manual repro: two concurrent BROWSE_STATE_FILE=<tmp>/browse.json bun run browse/src/cli.ts status calls now both exit 0 and converge on the same PID

Closes #299.

@garrytan
Copy link
Owner

Superseded by #325 — we implemented an exclusive lockfile (O_CREAT|O_EXCL) in browse/src/cli.ts that prevents the same TOCTOU race. Thanks for identifying the issue!

@garrytan garrytan closed this Mar 22, 2026
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.

browse: parallel startup race on shared browse.json.tmp can fail bootstrap with ENOENT

2 participants