Welcome! Log In Create A New Profile

Advanced

Re: zero size buf in writer in 1.17.2

Witold Filipczyk
July 30, 2019 07:24AM
On Mon, Jul 29, 2019 at 07:48:41PM +0300, Maxim Dounin wrote:
> Hello!
>
> On Sun, Jul 28, 2019 at 04:32:18PM +0200, Witold Filipczyk wrote:
>
> > Hi,
> > There is error in log:
> > 2019/07/28 09:46:10 [alert] 2471467#2471467: *407 zero size buf in writer t:1 r:1 f:0 00007F482A259000 00007F482A259000-00007F482A259000 0000000000000000 0-0 while sending response to client, client: 127.0.0.1, server: localhost, request: "GET /Skrypty-m.js HTTP/1.1", host: "localhost"
> >
> > Reproducible at least on two machines.
>
> [...]
>
> > Skrypty-m.js in the attachment.
> > The error does not occur in 1.17.1 and earlier.
>
> Thank you for the report, it seems to be a problem introduced in
> ac5a741d39cf. I'm able to reproduce it with the file and gzip
> configuration provided.
>
> The following patch should fix this:
>
> # HG changeset patch
> # User Maxim Dounin <mdounin@mdounin.ru>
> # Date 1564415524 -10800
> # Mon Jul 29 18:52:04 2019 +0300
> # Node ID aff4d33c72d8ee1a986d3e4c8e5c0f3d1b20962f
> # Parent e7181cfe9212de7f67df805bb746519c059b490b
> Gzip: fixed "zero size buf" alerts after ac5a741d39cf.
>
> After ac5a741d39cf it is now possible that after zstream.avail_out
> reaches 0 and we allocate additional buffer, there will be no more data
> to put into this buffer, triggering "zero size buf" alert.
>
> Fix is to avoid allocating additional buffer in this case, by checking
> if last deflate() call returned Z_STREAM_END.
>
> diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
> --- a/src/http/modules/ngx_http_gzip_filter_module.c
> +++ b/src/http/modules/ngx_http_gzip_filter_module.c
> @@ -778,7 +778,7 @@ ngx_http_gzip_filter_deflate(ngx_http_re
>
> ctx->out_buf->last = ctx->zstream.next_out;
>
> - if (ctx->zstream.avail_out == 0) {
> + if (ctx->zstream.avail_out == 0 && rc != Z_STREAM_END) {
>
> /* zlib wants to output some more gzipped data */
>

No error so far, thanks.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

zero size buf in writer in 1.17.2 Attachments

Witold Filipczyk 1932 July 28, 2019 10:34AM

Re: zero size buf in writer in 1.17.2

Maxim Dounin 528 July 29, 2019 12:50PM

Re: zero size buf in writer in 1.17.2

Witold Filipczyk 467 July 30, 2019 07:24AM

Re: zero size buf in writer in 1.17.2

Maxim Dounin 605 July 31, 2019 10:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 213
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready