Output body buffer chain "flattening" doesn't work unless proxy buffering is off

Srebrenko Šehić ssehic at gmail.com
Mon Jun 7 09:29:21 MSD 2010

On Sun, Jun 6, 2010 at 10:57 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> You don't marked buffers as send, and proxy has no more free
> buffers to use (proxy_buffers defaults to 8 x 8k == 64k on
> amd64; looks like you didn't tested your code on 32-bit
> platforms... :)).

Makes sense. How does one mark them as sent? I didn't see any flags in
ngx_buf_t that makes that obvious. I did try to play with b->last_buf
(but that should be set to 1 only for the very last buffer in the
response) and also b->last_in_chain, but that did not make any

Actually, I only tested on a 32-bit platform, but my responses were
all <64 KB. Only 1 was larger - and failed :-). I'll do much more
regression testing once I got it working :-)

> This is actually strange.  With proxy_buffering off; it should
> stop doing anything usefull as soon as proxy_buffer_size will be
> exceeded.  Well, it will call output filter again and again, with
> the same buffer chain, but it doesn't seem to match words "works
> just fine".

I can't give you an explanation other then that it does work. I only
tested with response of around 96 KB (and I did not play with
proxy_buffers or proxy_buffer_size).

Anyways, thanks Maxim for, as always, an insightful response.

Best regards,

More information about the nginx-devel mailing list