Copilot commented on code in PR #3708:
URL: https://github.com/apache/brpc/pull/3708#discussion_r4612440443
##########
src/brpc/urma/urma_endpoint.cpp:
##########
@@ -908,6 +966,7 @@ int UrmaEndpoint::SendImm(uint32_t imm) {
<< _resource->remote_jetty->id.id
<< " state=" << GetStateStr()
<< " on " << _socket->description();
+ ReportFailure(UrmaFailureReason::SEND_POST);
Review Comment:
`urma_post_jetty_send_wr` can return `URMA_EAGAIN` for temporary provider
backpressure, but this path treats every non-success as `SEND_POST`, reports it
as the connection's runtime failure, and `HandleCompletion` then propagates the
error so the established socket is failed. That can unnecessarily quarantine a
healthy peer and turn transient ACK backpressure into an RPC failure; handle
`URMA_EAGAIN` as retryable/backpressure (as `CutFromIOBufList` already does)
without recording a transport failure.
##########
src/brpc/urma/urma_endpoint.cpp:
##########
@@ -707,23 +729,43 @@ ssize_t UrmaEndpoint::CutFromIOBufList(butil::IOBuf**
from, size_t ndata) {
size_t max_len = _remote_recv_block_size > 0
? _remote_recv_block_size
: GetUrmaRecvBlockSize();
- while (sge_index < static_cast<size_t>(max_sge) &&
- this_len < max_len && current < ndata) {
- auto* data = reinterpret_cast<UrmaIOBuf*>(from[current]);
- if (data->empty()) {
- ++current;
- continue;
- }
- ssize_t n = data->cut_into_sglist(sglist, &sge_index, to,
- max_sge, max_len - this_len);
+ if (copy_send) {
+ max_len = std::min(max_len, GetUrmaRecvBlockSize() -
+ (URMA_SEND_BUFFER_ALIGNMENT - 1));
+ }
+ for (size_t i = current;
+ i < ndata && this_len < max_len &&
+ sge_index < static_cast<size_t>(max_sge); ++i) {
+ const auto* data = reinterpret_cast<const UrmaIOBuf*>(from[i]);
+ const ssize_t n =
+ copy_send ? static_cast<ssize_t>(
+ std::min(from[i]->size(), max_len - this_len))
+ : data->DescribePrefix(sglist, &sge_index, max_sge,
+ max_len - this_len);
Review Comment:
The new batching loop no longer skips empty IOBufs. If `from[current]` is
empty, `DescribePrefix`/the copy path contributes zero bytes, `this_len` stays
zero, and the function breaks without reaching later buffers; likewise, an
empty entry immediately after a full prefix can leave `current` pointing at
that entry on the next iteration. This can silently return 0 and strand
subsequent RPC payloads whenever the write batch contains empty buffers.
Advance `current` past empty buffers before building each WR (the removed
implementation explicitly did this).
--
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]