Repository navigation
fix(workspace-fs): wait for released watchers during shutdown - #9662
Conversation
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…lesystem-watchers
close() waits for an aborted attach's native subscribe. With parcel's one-at-a-time native calls, a hung unsubscribe can leave that subscribe stuck forever and hang host-service shutdown. Use the same 5 s limit that already bounds unsubscribe.
What & why
A caller can stop the last listener, await filesystem shutdown, and then remove its checkout while the native watcher is still attached. The release path removes the entry from the path map immediately (so another listener can reattach), but that also hid the in-flight teardown from
FsWatcherManager.close().Keep that cleanup visible to shutdown, both when registration is in flight and when the watch is already live. Reattachment still gets a fresh entry; the existing timeout for a dead native stream is unchanged.
Found while verifying #9625 on macOS. The original crash report shows
FSEventsCallback → FSEventStreamStopin Parcel's deleted-root path. The early return from shutdown is reproducible; the native SIGTRAP itself did not recur on the unchanged PR in the latest default-worker run. This fixes a teardown race, not every possible native watcher crash.How I tested it
Checklist
Summary by cubic
Fixes a shutdown race in
FsWatcherManagerwhereclose()could resolve while the last listener's native watch was still tearing down, crashing when the checkout was removed immediately after.close()waits on them alongside still-registered watchers.Written for commit cc818b2. Summary will update on new commits.
Summary by CodeRabbit