Skip to content

Bound hydration wait - #72

Merged
dragotin merged 6 commits into
mainfrom
boundHydWait
Oct 21, 2026
Merged

dragotin merged 6 commits into
mainfrom
boundHydWait

Conversation

@dragotin

@dragotin dragotin commented Oct 5, 2026

Copy link
Copy Markdown
Member

No description provided.

@dragotin
dragotin requested a review from TheOneRing October 5, 2026 15:28
@dragotin
dragotin marked this pull request as draft October 5, 2026 15:29
@dragotin
dragotin requested a balanced review from Copilot October 12, 2026 16:02
@dragotin
dragotin marked this pull request as ready for review October 12, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Socket disconnects can still terminate or abort the process, and shutdown can silently drop accepted hydration requests.

4 open findings
What changed in this PR

Bounds hydration waits and improves socket/job coordination for FUSE file hydration.

Changes:

  • Adds configurable hydration timeouts and result states.
  • Reports queue/send failures promptly and makes transfer IDs atomic.
  • Adds socket framing and timeout integration tests.
File Description
INTEGRATION.md Documents configuration and socket behavior.
src/​openvfsfuse/​config.json Adds the default timeout.
src/​openvfsfuse/​main.cpp Parses timeout configuration.
src/​openvfsfuse/​openvfsfuse.cpp Implements bounded hydration waiting.
src/​openvfsfuse/​openvfsfuse.h Stores the timeout argument.
src/​openvfsfuse/​sharedmap.cpp Adds condition-variable waiting.
src/​openvfsfuse/​sharedmap.h Defines hydration states and results.
src/​openvfsfuse/​socketthread.cpp Propagates send and shutdown failures.
src/​openvfsfuse/​socketthread.h Makes PostMsg report failure.
src/​openvfsfuse/​tests/​CMakeLists.txt Registers the socket integration test.
src/​openvfsfuse/​tests/​socketthreadtest.cpp Tests framing, timeout, and shutdown behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/openvfsfuse/socketthread.cpp Resolved
Comment thread src/openvfsfuse/socketthread.cpp Resolved
Comment thread src/openvfsfuse/socketthread.cpp Resolved
Comment thread src/openvfsfuse/openvfsfuse.cpp Resolved
@TheOneRing

Copy link
Copy Markdown
Collaborator

Is a timeout here ideal at all?
I mean we should be able to see when the last update was to the file was performed, to see whether the file is still downloading.
The download of large file can just take time...

toxicphreAK and others added 4 commits October 20, 2026 14:37
First, the job was registered by the socket thread only after the send
succeeded.

The job is now inserted before the message is posted, so no waiter can
observe the absence of a job it just posted.

Second, SharedMap now carries a condition variable and SharedMap::waitForJob()
blocks on it with a deadline.

Also made _transfer_id atomic.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Configuration conversion errors can terminate startup, socket initialization failures can hang the test, and reply-size documentation contradicts the implementation.

1 open issue
3 previously missed issues

In code that hasn't changed since last review

Medium severity Document the 100 KiB socket input buffer limit

INTEGRATION.md:62

The unlimited-reply claim contradicts processSocketInput(): it discards buffered, unterminated data exceeding 100 KiB. A larger reply split across polling cycles can therefore be lost and cause a hydration timeout. Document this limit rather than promising arbitrary reply sizes.

Medium severity Catch configuration type errors during startup parsing

src/​openvfsfuse/​main.cpp:100

A valid JSON config containing "hydrationTimeoutSeconds": "300" or null throws json::type_error here, outside the parsing catch. main() does not catch it, so startup terminates instead of reporting a controlled configuration error. Move setting extraction, including the ignoreApps conversions, inside the try block.

Medium severity Check socket initialization before blocking on accept

src/​openvfsfuse/​tests/​socketthreadtest.cpp:90

If socket initialization fails, CreateThread() returns false without connecting, but the test proceeds to a blocking accept() with no client. The test then hangs instead of reporting the startup failure. Check the return value before accepting.

3 resolved since last review

Review effort: Balanced

@dragotin

Copy link
Copy Markdown
Member Author

About the timeout: The current built in timeout is the overall timeout after that a running request is stopped. It is true that it is independent of any progress on file download, but that is not in scope of this PR.

Comment thread src/openvfsfuse/sharedmap.h Resolved
@dragotin
dragotin merged commit c20c0fe into main Oct 21, 2026
1 check passed
@dragotin
dragotin deleted the boundHydWait branch October 21, 2026 07:31
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.

4 participants