Skip to content

fix(sdk): split chunks >1.8 GiB in forwarding_thread to prevent gRPC 2 GiB crash (#11993) - #12937

Open
Saraswat123 wants to merge 1 commit into
rerun-io:mainfrom
Saraswat123:fix/grpc-chunk-size-limit-11993
Open

Saraswat123 wants to merge 1 commit into
rerun-io:mainfrom
Saraswat123:fix/grpc-chunk-size-limit-11993

Conversation

@Saraswat123

Copy link
Copy Markdown

What

Wire the existing Chunk::split_rows utility into forwarding_thread so that any chunk exceeding 1.8 GiB is split into sub-chunks before encoding and forwarding to sinks.

Fixes #11993.

Background

gRPC (and protobuf) use a signed 32-bit length prefix, capping a single message at 2 GiB. When a recording contains very dense data — e.g. a 2 GiB+ point cloud logged in a single log() call — the resulting chunk hits this limit and the gRPC write path crashes/disconnects.

The fix, suggested by @emilk in the issue, is to split oversized chunks before transmitting them. Chunk::split_rows already exists for exactly this purpose (it is used in re_chunk_store for storage bookkeeping) but was never called in the forwarding path.

Solution

Add a FORWARDING_CHUNK_SPLIT_OPTIONS constant with chunk_max_bytes = 1_800_000_000 (1.8 GiB — leaves ~340 MiB headroom below the 2 GiB limit) and call Chunk::split_rows in both chunk-receive paths inside forwarding_thread:

  1. The while let Ok(chunk) = chunks.try_recv() drain loop (runs on flush/shutdown).
  2. The recv(chunks) arm of the select! loop (the hot path).

For chunks under 1.8 GiB split_rows returns the original chunk immediately (no allocation), so there is no overhead on the normal code path.

Testing

The repro from the issue (C++ snippet logging a 2 GiB+ point cloud via gRPC) should no longer crash. I do not have the full build environment here to run the full test suite, but the change is confined to forwarding_thread and the logic is straightforward.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Thk1PDVQb2A4yrRmg8vRj

… limit crash

gRPC/protobuf uses a signed 32-bit length prefix, capping single messages at 2 GiB.
Chunks larger than this limit cause a panic/disconnect in the write path.

Wire Chunk::split_rows (already used in re_chunk_store) into forwarding_thread
so that any chunk exceeding 1.8 GiB is split into sub-chunks before encoding.
The 1.8 GiB threshold leaves headroom for encoding overhead.

Fixes rerun-io#11993

@github-actions github-actions Bot 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.

Hi! Thanks for opening this pull request.

Because this is your first time contributing to this repository, make sure you've read our Contributor Guide and Code of Conduct.

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.

Cannot send 2GiB+ chunks over gRPC

1 participant