Conversation
…t cannot freeze the server A linked case can live on a network mount. When that mount goes away, a hard mount makes stat() wait indefinitely, and the existsSync() probes in the case routes and the workspace hook/statusline helpers ran on the event loop, so a single GET /api/cases (or a session create in that workspace) froze the whole web server until the mount came back. Add boundedPathExists() (src/utils/bounded-path-probe.ts): an async stat that answers "absent" after 1.5 s, shares one in-flight probe per path, remembers a timed-out path until its stat finally settles, and refuses to start new probes while two stalled ones still hold libuv threadpool workers. Route the read-side probes in case-routes.ts and hooks-config.ts through it. The settings writers in hooks-config.ts use an async lstat that treats only ENOENT as missing, so an unreachable workspace is never mistaken for an empty one and has its settings recreated.
Owner
|
DRAFT_COMMENT |
Contributor
Author
|
Hi @Ark0N, it looks like your comment here came through as the placeholder text "DRAFT_COMMENT", so I think the actual review didn't post. Happy to pick it up whenever you get a chance to re-send it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a linked case lives on a network mount (NFS, SMB, sshfs) that becomes unreachable, the whole web UI freezes. The case list and session creation ran synchronous
existsSyncchecks on that path, and on a hard mount those block the Node event loop until the mount comes back.This adds a small
boundedPathExistshelper (src/utils/bounded-path-probe.ts). It stats asynchronously and reports the path as absent after 1.5 s. It remembers a stalled path until its stat finally returns, so callers don't pile up probes on it, and it stops starting new probes while two stalled ones still hold libuv threadpool workers.The read-side probes in the case routes and in the workspace hook/statusline helpers now use it. The settings writers use an async
lstatthat only treats ENOENT as missing, so an unreachable workspace is never mistaken for an empty one and overwritten.Behaviour during an outage: an unreachable linked case is left out of
GET /api/cases, andGET /api/cases/:namereturns NOT_FOUND until the mount answers again. Writes to that workspace still wait on the mount, but they no longer block the event loop.Tests
GET /api/casesstill answers promptly. It fails on master (about 4 s).hooks-configandcase-routespass (402 tests).I imported the helper directly rather than through the
./utilsbarrel. Happy to move it into the barrel if you prefer.