increase buffer size for stream to lines to accomodate oversize packets#3112
increase buffer size for stream to lines to accomodate oversize packets#3112
Conversation
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
The change increases Reviewed by minimax-m2.5-20260211 · 164,401 tokens |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/util/utilfn/streamtolines.go`:
- Around line 23-25: The global const maxLineLength is too large for all callers
and should be scoped to RPC usage; change the shared constant into a smaller
safe default (e.g., defaultMaxLineLength) and add an RPC-specific limit (e.g.,
rpcMaxLineLength) or an explicit constructor/parameter for StreamToLines and
LineWriter so callers can opt into the 64MB cap only for RPC streams; update
StreamToLines and LineWriter to accept a configurable maxLineLength parameter
(or provide NewStreamToLinesWithLimit / NewLineWriterWithLimit) and use
defaultMaxLineLength when not provided, reserving the 64MB value only for
RPC-specific construction paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3e7f142e-f314-4675-8c5f-20e1117e0ee3
📒 Files selected for processing (1)
pkg/util/utilfn/streamtolines.go
| // needs to be large enough to read the largest RPC packet | ||
| // there are some legacy file transfer packets that can send up to 32m (base64 encoded) | ||
| const maxLineLength = 64 * 1024 * 1024 |
There was a problem hiding this comment.
Scope the 64MB cap to RPC-specific usage instead of changing the global default.
This constant is shared by both StreamToLines and LineWriter, so Line 25 now allows ~64MB buffering per in-flight line for all callers. That can materially increase memory pressure under concurrent streams. Prefer a configurable limit (or an RPC-specific constructor/path with 64MB) while keeping a safer general default.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@pkg/util/utilfn/streamtolines.go` around lines 23 - 25, The global const
maxLineLength is too large for all callers and should be scoped to RPC usage;
change the shared constant into a smaller safe default (e.g.,
defaultMaxLineLength) and add an RPC-specific limit (e.g., rpcMaxLineLength) or
an explicit constructor/parameter for StreamToLines and LineWriter so callers
can opt into the 64MB cap only for RPC streams; update StreamToLines and
LineWriter to accept a configurable maxLineLength parameter (or provide
NewStreamToLinesWithLimit / NewLineWriterWithLimit) and use defaultMaxLineLength
when not provided, reserving the 64MB value only for RPC-specific construction
paths.
No description provided.