AlinsRan commented on issue #11244:
URL: https://github.com/apache/apisix/issues/11244#issuecomment-4964436448

   Closing this out with the conclusion from the analysis above.
   
   Summary: this is not a leak in `hold_body_chunk` — it is an unbounded 
batch-processor backlog of large response bodies, made visible by LuaJIT's 
non-moving GC and the `lj_alloc` allocator (which only returns blocks >= 128 KB 
to the OS and trims the arena at >= 2 MB), so RSS stays at the fragmented 
high-water mark after the load stops.
   
   Mitigations, both available today, no code change needed:
   
   - `max_pending_entries` (plugin metadata, e.g. 
`/apisix/admin/plugin_metadata/kafka-logger`) — caps the backlog and drops the 
excess. Added in #12338, so it is available since **3.13.0**; it did not exist 
in 3.8.0, which is why there was no way out at the time this was reported.
   - `max_resp_body_bytes` (plugin attribute, default 512 KB) — caps the body 
kept per entry.
   
   Trade-off, stated plainly: bounded memory + full bodies + a sink that can't 
keep up ⇒ excess must be dropped. No buffer setting is both bounded and 
lossless under sustained overload.
   
   #13581 adds an optional byte-precise `max_buffer_bytes` variant; it is a 
convenience, not a prerequisite. Please reopen (or comment there) if you still 
see growth with `max_pending_entries` set on a recent version.
   


-- 
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]

Reply via email to