Repository navigation
Bound the empty-read retry in read_complete - #1296
Closed
Pranav-error wants to merge 1 commit into
Closed
Pranav-error wants to merge 1 commit into
Pranav-error wants to merge 1 commit into
Conversation
Member
|
Please, rebase |
read_complete() bounded one retry path but not the other. A short read sleeps 10ms and gives up after 100 tries; EAGAIN retried immediately, forever, with no counter and no sleep. The asymmetry looks unintended. Against a connected but silent peer the old path issues 5.4 million read() calls in 2 seconds and never returns, so a caller waiting on a management response spins a core until something else kills it. This sleeps 10ms before retrying, which is what the short-read path already does, and gives up after MANAGEMENT_READ_EMPTY_RETRIES with ETIMEDOUT. The bound is the part worth arguing about, so it is a named constant rather than a literal. read_complete() reads the response header, and that header only arrives once the command has finished, so a backup can legitimately keep the caller waiting for minutes. 30000 x 10ms is five minutes, which is meant to be well clear of a slow command while still being finite. A different number, or a per-command budget, may be the better answer. Verified with a harness that runs both versions against a non-blocking socket whose peer never writes. Not verified against a real hung management command. Signed-off-by: sai pranav <[email protected]>
Pranav-error
force-pushed
the
bound-eagain-retry
branch
from
October 8, 2026 05:41
33f0aa9 to
ee56aff
Compare
Member
|
Rebased and merged. Thanks for your contribution ! |
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.
Draft, as you suggested on #1295. The change is small; the number in it is the part worth arguing about.
read_complete()bounds one retry path but not the other. A short read sleeps 10ms and gives up after 100 tries.EAGAINretried immediately, forever, with no counter and no sleep:Against a connected but silent peer that is 5.4 million
read()calls in 2 seconds, spinning a core until something else kills the process:(The harness uses a scaled-down bound so it finishes quickly; the real one is 30000.)
The number is the question
read_complete()reads the response header, and that header only arrives once the command has finished — so a backup can legitimately keep the caller waiting for minutes. Any bound here is therefore also a cap on how long a management command may take before the client gives up on it.I picked 30000 x 10ms = five minutes as something clear of a slow command but still finite, and put it in
management.hasMANAGEMENT_READ_EMPTY_RETRIESrather than burying a literal. I do not know your real upper bound for a backup on a large cluster, so this may be too low, and a per-command budget may be the better shape.Three ways this could go, whichever you prefer:
poll()on the socket rather than retryingread(). No arbitrary deadline and no spin, but a larger change to a shared path.On whether this is the CI hang
I do not claim it is. As I said on #1295, I have no stack trace from a hung runner and cannot reproduce the timeout locally. This is a real defect on its own — a busy loop with no exit — and fixing it is worthwhile regardless of what the CI turns out to be doing.
Verification
Builds clean,
clang-formatquiet,jsonmodule passes 6/6. Theclimodule segfaults here both with and without this change, because it needs a live server that the CI containers provide and I do not have locally — so it is not evidence either way.