Skip to content

fix: chunk store_load over RPC to avoid msgpack BufferFull (#8440)#9540

Draft
hiijoshi wants to merge 1 commit intoborgbackup:masterfrom
hiijoshi:fix/store-load-chunked-rpc
Draft

fix: chunk store_load over RPC to avoid msgpack BufferFull (#8440)#9540
hiijoshi wants to merge 1 commit intoborgbackup:masterfrom
hiijoshi:fix/store-load-chunked-rpc

Conversation

@hiijoshi
Copy link
Contributor

Description

Large repositories can have a chunks index exceeding the msgpack unpacker buffer size, causing BufferFull errors over SSH/RPC connections. This occurs because the current store_load implementation attempts to fetch the entire value in a single RPC call.

Changes

To resolve this, I have:

  • Added two new server-side methods: store_get_size and store_load_chunk.
  • Overridden store_load in RemoteRepository to fetch data in MAX_DATA_SIZE pieces.
  • Implemented client-side reassembly of the fetched chunks.

This ensures that no single RPC response exceeds the buffer limits while maintaining compatibility.

Fixes

Fixes #8440

@ThomasWaldmann ThomasWaldmann marked this pull request as draft March 24, 2026 13:55
Large repositories can have a chunks index exceeding the msgpack
unpacker buffer size, causing BufferFull errors over SSH/RPC.

Instead of loading the entire value in one RPC call, add two new
server-side methods (store_get_size, store_load_chunk) and override
store_load in RemoteRepository to fetch data in MAX_DATA_SIZE pieces,
reassembling on the client side.

Fixes borgbackup#8440
@hiijoshi hiijoshi force-pushed the fix/store-load-chunked-rpc branch from 2a9334e to 688afbf Compare March 24, 2026 13:58
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.40%. Comparing base (9d5687d) to head (688afbf).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9540   +/-   ##
=======================================
  Coverage   83.39%   83.40%           
=======================================
  Files          87       87           
  Lines       15469    15484   +15     
  Branches     2321     2322    +1     
=======================================
+ Hits        12901    12915   +14     
- Misses       1818     1819    +1     
  Partials      750      750           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 things:

  • did you review this code / think about it?
  • a test is missing.
  • when you asked whether you can work on this, I said "no, first fix your other PRs".

@hiijoshi
Copy link
Contributor Author

I apologize, Thomas. I was eager to help with #8440, but I realize I should have prioritized the previous PRs as you instructed. I will set this aside and go back to other PR right now.

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.

borg2: msgpack.Unpacker buffer size

2 participants