Skip to content

Commit

Permalink
rpc: remove netbuf header init check
Browse files Browse the repository at this point in the history
To check that netbuf header is initialized, we checked correlation_id,
treating 0 as special invalid value. But it turns out, we can get 0 if
correlation_id overflows uint32_t (this can happen on a reasonably busy
connection). The overflow itself is benign as correlation_id just wraps
around to 0 (and it is unlikely that there still remain entries with
these values in the _correlations map) but the check throws. Since it is
just a precautionary check that doesn't add much value, remove it.

(cherry picked from commit 58f4dbf)
  • Loading branch information
ztlpn authored and vbotbuildovich committed Jan 19, 2024
1 parent d5a7d87 commit ef24460
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/v/rpc/netbuf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ ss::future<ss::scattered_message<char>> netbuf::as_scattered() && {
iobuf out_buf = std::move(_out);
auto hdr = _hdr;

if (hdr.correlation_id == 0 || hdr.meta == 0) {
throw std::runtime_error(
"cannot compose scattered view with incomplete header. missing "
"correlation_id or remote method id");
}
if (
out_buf.size_bytes() >= _min_compression_bytes
&& rpc::compression_type::zstd == hdr.compression) {
Expand Down

0 comments on commit ef24460

Please sign in to comment.