From ceab1e700dbd1fb6ca3ebb8ca69224340d231eba Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Thu, 24 Dec 2020 01:02:36 -0500 Subject: [PATCH] [core] add comment for FastCGI mem use in hctx->rb (#3033) x-ref: "Memory Growth with PUT and full buffered streams" https://redmine.lighttpd.net/issues/3033 --- src/gw_backend.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gw_backend.c b/src/gw_backend.c index 1375936e..2a563065 100644 --- a/src/gw_backend.c +++ b/src/gw_backend.c @@ -2052,6 +2052,11 @@ handler_t gw_handle_subrequest(request_st * const r, void *p_d) { if ((r->conf.stream_response_body & FDEVENT_STREAM_RESPONSE_BUFMIN) && r->resp_body_started) { if (chunkqueue_length(&r->write_queue) > 65536 - 4096) { + /* Note: if apps inheriting gw_handle use hctx->rb, then those apps + * are responsible for limiting amount of data buffered in memory + * in hctx->rb. Currently, mod_fastcgi is the only core app doing + * so, and the maximum FCGI_Record size is 8 + 65535 + 255 = 65798 + * (FCGI_HEADER_LEN(8)+contentLength(65535)+paddingLength(255)) */ fdevent_fdnode_event_clr(hctx->ev, hctx->fdn, FDEVENT_IN); } else if (!(fdevent_fdnode_interest(hctx->fdn) & FDEVENT_IN)) {