Welcome! Log In Create A New Profile

Advanced

Re: handle NGX_AGAIN properly

January 03, 2015 07:00PM
Hi Julien,

I was having the same problem with NGX_AGAIN and could solved it.
Did you fix your problem?
I can try to help you.

Regards,
Wandenberg

On Thu, Jul 18, 2013 at 1:37 AM, Julien Zefi <jzefip@gmail.com> wrote:

> Hi all,
>
> thanks for the help but after more changes and taking in count your
> suggestions i am still stuck with the problem (it cannot be in Lua, must be
> done in C as i am streaming binary data).
>
> If anyone of you is interested, i will put a budget of 100USD for who is
> interested into fix the test case as required, for more details send me a
> private email to discuss the requirements and what is expected as result.
>
> thanks,
>
>
>
> On Sun, Jul 14, 2013 at 10:57 PM, Yichun Zhang (agentzh) <
> agentzh@gmail.com> wrote:
>
>> Hello!
>>
>> On Sun, Jul 14, 2013 at 8:43 PM, Julien Zefi wrote:
>> >
>> > 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).
>> >
>>
>> 1. You should simply call ngx_http_output_filter(r, NULL); in your
>> r->write_event_handler, but you set r->write_event_handler to
>> ngx_http_test_stream_handler which always emits brand new data. I'm
>> guessing you don't really understand how the ngx_http_writer and
>> ngx_http_set_write_handler functions are implemented in the Nginx
>> core. Look harder.
>>
>> 2. You should not set r->header_only = 1 in your case because you're
>> actually sending out the response body. Ensure that you know how a
>> flag works before you start using it.
>>
>> 3. Another obvious mistake is that you incorrectly perform
>>
>> r->main->count++;
>>
>> without decrementing it by calling ngx_http_finalize_request, which
>> will certainly lead to request hang. Ensure that you understand this
>> flag before using it.
>>
>> > 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 ?
>> >
>>
>> This is trivial to implement by writing some Lua code using ngx_lua
>> module:
>>
>> location /t {
>> content_by_lua '
>> local message = "..."
>> for i = 1, 100 do
>> ngx.print(message)
>> ngx.flush(true)
>> ngx.sleep(0.001)
>> end
>> ';
>> }
>>
>> Maybe you can just use ngx_lua for your purposes without all the pain
>> of understanding the nginx internals (you seem to lack a lot of
>> knowledge here). If you insist in writing your own nginx C module,
>> then just check out how ngx_lua implements all the APIs demonstrated
>> in the example above. You can also check out the official
>> documentation of ngx_lua:
>>
>> http://wiki.nginx.org/HttpLuaModule
>>
>> Best regards,
>> -agentzh
>>
>
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
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 1165 July 09, 2013 08:14PM

Re: handle NGX_AGAIN properly

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

Re: handle NGX_AGAIN properly

Julien Zefi 657 July 13, 2013 08:22PM

Re: handle NGX_AGAIN properly

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

Re: handle NGX_AGAIN properly Attachments

Julien Zefi 588 July 14, 2013 11:44PM

Re: handle NGX_AGAIN properly

wandenberg 634 January 03, 2015 07:00PM



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

Online Users

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