fix: poll POLLOUT in a loop instead of aborting after single 300ms miss#69859
Open
mangodxd wants to merge 3 commits into
Open
fix: poll POLLOUT in a loop instead of aborting after single 300ms miss#69859mangodxd wants to merge 3 commits into
mangodxd wants to merge 3 commits into
Conversation
In RequestClient._send_recv, a single 300ms socket.poll(POLLOUT) miss was treated as an immediate SaltReqTimeoutError, ignoring the caller's configured request timeout (return_retry_timer / request_channel_timeout). Mirror the POLLIN loop pattern already used later in the same method: poll in a loop, only abort when the future completes (timeout fired). Fixes saltstack#69802
…etry test - Remove unreachable lines 2168-2171 (future already done per review) - Add changelog/69816.fixed.md - Add test_request_client_pollout_retries_on_transient_failure verifying that consecutive POLLOUT misses are retried
twangboy
requested changes
Jul 23, 2026
| sent = False | ||
| while not future.done(): | ||
| if await socket.poll(300, zmq.POLLOUT): | ||
| await socket.send(message) |
Contributor
There was a problem hiding this comment.
If socket.poll(300, zmq.POLLOUT) blocks for up to 300ms, the request future could potentially time out or be cancelled right during that poll window.
To prevent sending a message after the request has already been marked done/cancelled, we should double-check future.done() right after poll() returns True before executing socket.send().
if await socket.poll(300, zmq.POLLOUT):
if future.done():
break
await socket.send(message)
sent = True
break
Author
There was a problem hiding this comment.
Fixed in 5ad9022. Also checked 3006.x — it uses a different architecture (tornado generators, not asyncio RequestClient._send_recv) so the same POLLOUT issue does not exist there.
Contributor
|
Also, if this issue exists on 3006.x branch, the fix should be done there. |
twangboy requested: if socket.poll(300, zmq.POLLOUT) blocks for up to 300ms, the request future could time out or be cancelled during that window. Double-check future.done() after poll returns True before calling socket.send().
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.
WHY
ZMQ's async event loop polls POLLOUT once per send attempt. When the socket buffer is full (common under heavy load), a single 300ms POLLOUT miss causes SaltClientError, crashing the minion connection.
HOW
VERIFY
Fixes #69816