Welcome! Log In Create A New Profile

Advanced

Re: handle NGX_AGAIN properly

Julien Zefi
July 14, 2013 11:44PM
Hi,


On Sun, Jul 14, 2013 at 12:40 AM, Yichun Zhang (agentzh)
<agentzh@gmail.com>wrote:

> Hello!
>
> On Sat, Jul 13, 2013 at 4:43 PM, Julien Zefi wrote:
> >
> > I have been trying many workarounds without luck, the last one that i
> have
> > is that if in my timer-callback the flush returns NGX_AGAIN, invoke a new
> > handler that sends out an empty chain, but it continue returning
> NGX_AGAIN,
> > it never backs to NGX_OK, this is how it looks:
> >
>
> It seems that what you're doing is very wrong. You'd better take a
> look at how the ngx_http_writer and ngx_http_set_write_handler
> functions are implemented in the Nginx core instead of shooting in the
> darkness. Basically:
>
> 1. Flush outputs by r->write_event_handler instead of in your timer
> handler because you should only retry sending the outputs upon a
> epoll/poll/select write event.
>
> 2. By "sending out an empty chain", I actually mean
>
> rc = ngx_http_output_filter(r, NULL);
>
> You can see this line in the ngx_http_writer function. You're just
> sending out a last_buf chain.
>
>
Sorry by bother you again but i still cannot figure out how some internals
are not working as i expect. I have take in count your suggestions and
wrote a new test case (file attached).

My goal in that test case is to let NginX invoke my write_event_handler
once the socket is ready to write again when a NGX_AGAIN is found, despite
the test case is not perfect for all things that need to be fixed, i have
isolated as much as i can.

The test case writes 12.3KB of data every 1ms, at some point it will raise
NGX_AGAIN but from there is not recovering, it keeps in the same state
forever, do you see any specific problem when handling the exception ?

thnks
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

handle NGX_AGAIN properly

Julien Zefi 1170 July 09, 2013 08:14PM

Re: handle NGX_AGAIN properly

Yichun Zhang (agentzh) 615 July 09, 2013 09:04PM

Re: handle NGX_AGAIN properly

Julien Zefi 660 July 13, 2013 08:22PM

Re: handle NGX_AGAIN properly

Yichun Zhang (agentzh) 565 July 14, 2013 02:42AM

Re: handle NGX_AGAIN properly Attachments

Julien Zefi 591 July 14, 2013 11:44PM

Re: handle NGX_AGAIN properly

wandenberg 641 January 03, 2015 07:00PM



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

Online Users

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