amoxic opened a new pull request, #3250:
URL: https://github.com/apache/brpc/pull/3250
### What problem does this PR solve?
Issue Number: resolves #3245
Problem Summary:
When a peer disconnects after `StreamAccept()` succeeds but before the RPC
response binds the response stream to the host socket, `Socket::AddStream()`
can fail inside `Stream::SetHostSocket()`. The previous code treated this as an
impossible state and aborted the server with `CHECK(false)`.
This PR turns that path into a normal runtime failure so the current
RPC/stream is failed and the server process stays alive.
### What is changed and the side effects?
Changed:
- Make `Stream::SetHostSocket()` return `-1` with `errno` instead of
aborting when `Socket::AddStream()` fails.
- Handle response stream bind failures in `SendRpcResponse()` by setting
controller failure, failing the affected stream(s), and returning early.
- Keep response write completion joined through a scope guard so tracing
data is still finalized on early returns.
- Add unit tests for `SetHostSocket()` failure and the server-side
disconnect-before-response path.
Side effects:
- Performance effects:
No expected steady-state performance impact. Extra work is only added on
the error path.
- Breaking backward compatibility:
No API change. The behavior changes from process abort to RPC/stream
failure when the host socket is already failed.
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]