Skip to content

fix: handle partial Redis rejection writes - #30

Merged
thweetkomputer merged 1 commit into
masterfrom
fix/redis-rejection-partial-writes
Aug 29, 2026
Merged

fix: handle partial Redis rejection writes#30
thweetkomputer merged 1 commit into
masterfrom
fix/redis-rejection-partial-writes

Conversation

@thweetkomputer

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: N/A

Problem Summary:

The Redis connection-limit rejection path uses non-blocking send() but assumes the complete error response is written in one call. A partial write can therefore truncate -ERR max number of clients reached before the accepted fd is closed.

This ports the follow-up fix from apache/brpc#3498.

What is changed and the side effects?

Changed:

  • Continue sending the remaining plaintext Redis error after a partial write.
  • Retry send() after EINTR.
  • Stop immediately on EAGAIN, EWOULDBLOCK, or any other error, preserving the non-blocking accept path.
  • Leave the pre-TLS rejection path unchanged.

Side effects:

  • Performance effects(性能影响): The over-limit plaintext rejection path may perform more than one non-blocking send() after a partial write. Accepted connections, request handling, and TLS rejection are unaffected.

  • Breaking backward compatibility(向后兼容性): None.


Check List:

  • git diff --check origin/master...HEAD
  • cmake --build /tmp/eloqdata-brpc-partial-build --target brpc_server_unittest --parallel 4
  • Focused ServerTest coverage passed: dedicated-listener validation, plaintext rejection, pre-TLS rejection, and idle-connection slot recovery (4/4).
  • The complete unit-test suite was not run.

The fresh unit-test configuration used a temporary CMAKE_PROJECT_INCLUDE compatibility macro because current master calls the removed use_cxx11() macro from test/CMakeLists.txt; that unrelated workaround is not part of this PR.

@thweetkomputer
thweetkomputer marked this pull request as ready for review August 29, 2026 07:33
@thweetkomputer
thweetkomputer merged commit bf7c9cb into master Aug 29, 2026
9 checks passed
@thweetkomputer
thweetkomputer deleted the fix/redis-rejection-partial-writes branch August 29, 2026 10:39
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.

1 participant