Skip to content

Avoid JSONRPC client write spins - #13329

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:jsonrpc-client-write-ready
Jun 29, 2026
Merged

Avoid JSONRPC client write spins#13329
bneradt merged 1 commit into
apache:masterfrom
bneradt:jsonrpc-client-write-ready

Conversation

@bneradt

@bneradt bneradt commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

JSONRPC clients use nonblocking Unix sockets, so a full peer receive
buffer can make write return EAGAIN. The old retry loop treated that
like EINTR and immediately retried forever, which could hang the
jsonrpc server tests during large request and restart coverage.

This waits for socket write readiness before retrying transient
backpressure and treats an unwritable or zero-byte write as a failure.
This also adds a regression test that fills a socketpair and verifies
that the helper returns instead of spinning.

Copilot AI review requested due to automatic review settings June 25, 2026 04:00
@bneradt bneradt added this to the 11.0.0 milestone Jun 25, 2026
@bneradt bneradt self-assigned this Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/shared/rpc/IPCSocketClient.cc
Comment thread src/mgmt/rpc/server/unit_tests/test_rpcserver.cc Outdated
JSONRPC clients use nonblocking Unix sockets, so a full peer receive
buffer can make write return EAGAIN. The old retry loop treated that
like EINTR and immediately retried forever, which could hang the
jsonrpc server tests during large request and restart coverage.

This waits for socket write readiness before retrying transient
backpressure and reports ETIMEDOUT when the readiness wait expires,
while preserving readiness poll errors. This also adds a regression
test that fills a socketpair and verifies that the helper returns with
that timeout signal instead of spinning.
@bneradt
bneradt force-pushed the jsonrpc-client-write-ready branch from 9a0684c to fb13f27 Compare June 25, 2026 20:30
@brbzull0

Copy link
Copy Markdown
Contributor

Looks good to me!

@bneradt
bneradt requested a review from cmcfarlen June 29, 2026 16:01
@bneradt
bneradt merged commit 18d7a9d into apache:master Jun 29, 2026
15 checks passed
@bneradt
bneradt deleted the jsonrpc-client-write-ready branch June 29, 2026 16:06
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Jul 21, 2026
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jul 21, 2026
@bneradt

bneradt commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Marking as backport to 10.1.x and 10.2.x because it's annoying to have these tests fail in CI for those branches.

@cmcfarlen cmcfarlen moved this from For v10.1.1 to Picked v10.1.1 in ATS v10.1.x Jul 27, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.1.4 Jul 27, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.1.x branch

cmcfarlen pushed a commit that referenced this pull request Jul 27, 2026
JSONRPC clients use nonblocking Unix sockets, so a full peer receive
buffer can make write return EAGAIN. The old retry loop treated that
like EINTR and immediately retried forever, which could hang the
jsonrpc server tests during large request and restart coverage.

This waits for socket write readiness before retrying transient
backpressure and reports ETIMEDOUT when the readiness wait expires,
while preserving readiness poll errors. This also adds a regression
test that fills a socketpair and verifies that the helper returns with
that timeout signal instead of spinning.

(cherry picked from commit 18d7a9d)
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jul 29, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Jul 29, 2026
JSONRPC clients use nonblocking Unix sockets, so a full peer receive
buffer can make write return EAGAIN. The old retry loop treated that
like EINTR and immediately retried forever, which could hang the
jsonrpc server tests during large request and restart coverage.

This waits for socket write readiness before retrying transient
backpressure and reports ETIMEDOUT when the readiness wait expires,
while preserving readiness poll errors. This also adds a regression
test that fills a socketpair and verifies that the helper returns with
that timeout signal instead of spinning.

(cherry picked from commit 18d7a9d)
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
JSONRPC clients use nonblocking Unix sockets, so a full peer receive
buffer can make write return EAGAIN. The old retry loop treated that
like EINTR and immediately retried forever, which could hang the
jsonrpc server tests during large request and restart coverage.

This waits for socket write readiness before retrying transient
backpressure and reports ETIMEDOUT when the readiness wait expires,
while preserving readiness poll errors. This also adds a regression
test that fills a socketpair and verifies that the helper returns with
that timeout signal instead of spinning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Picked v10.1.1
Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

4 participants