Welcome! Log In Create A New Profile

Advanced

Re: Dealing with buffered data with upstream generated response

Maxim Dounin
November 29, 2011 01:32PM
Hello!

On Mon, Nov 28, 2011 at 11:52:38AM -0500, Umesh Sirsiwal wrote:

> I am developing a body filter which transforms outgoing stream. As
> part of the function, the incoming stream is copied in new buffer
> and sent. This in some cases results in a condition where my filter
> has busy buffers but the upper layers don't have any busy buffer. In
> our case the data is generated by upstream module. Since upstream
> module does not pay attention to connection->buffered, the
> output_filter is never called again to flush my busy buffers and the
> transfer just hangs.
>
> Adding r->connection->buffered to the or condition solves the hang.
>
> if (u->out_bufs || u->busy_bufs) {
> rc = ngx_http_output_filter(r, u->out_bufs);
>
> if (rc == NGX_ERROR) {
> ngx_http_upstream_finalize_request(r, u, 0);
> return;
> }
>
> ngx_chain_update_chains(&u->free_bufs, &u->busy_bufs,
> &u->out_bufs, u->output.tag);
> }
>
> Is this nginx bug or am I missing something?

I tend to think this is a bug, and it should probably manifest
itself with e.g. gzip filter as well.

(Well, as far as I see transfer shouldn't hang completely, but it
will be only resumed as soon as upstream sends some more data or
closes connection.)

It would be superb if you'll be able to provide test case which
catches this for our test suite (http://mdounin.ru/hg/nginx-tests).

I'll look into this more closely as time permits.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Dealing with buffered data with upstream generated response

Umesh Sirsiwal November 28, 2011 11:54AM

RE: Dealing with buffered data with upstream generated response

Sirsiwal, Umesh November 29, 2011 08:08AM

Re: Dealing with buffered data with upstream generated response

Maxim Dounin November 29, 2011 01:32PM

Re: Dealing with buffered data with upstream generated response

Umesh Sirsiwal November 29, 2011 02:20PM

Re: Dealing with buffered data with upstream generated response

Umesh Sirsiwal December 02, 2011 11:14AM

Re: Dealing with buffered data with upstream generated response

Maxim Dounin December 02, 2011 12:04PM

Re: Dealing with buffered data with upstream generated response

Umesh Sirsiwal December 02, 2011 01:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
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