Welcome! Log In Create A New Profile

Advanced

RE: [nginx] Fixed background requests with asynchronous operations.

July 27, 2017 05:46AM
> -----Original Message-----
> From: nginx-devel [mailto:nginx-devel-bounces@nginx.org] On Behalf Of Maxim Dounin
> Sent: Thursday, July 27, 2017 11:54 AM
> To: nginx-devel@nginx.org
> Subject: Re: [nginx] Fixed background requests with asynchronous operations.
>
> The NGX_AGAIN returned from a content phase handler when you started an AIO operation looks wrong: it means that nginx is already writing a response and was blocked by a full socket buffer. In this case nginx will assume it should continue writing based on socket's write events, and will close the connection as long as everything is written (no r->buffered, c->buffered is set). Before the Roman's patch the situation was the same:
> there is not r->blocking check in ngx_http_writer(), so it would close the connection as long as a write event happen for some reason.
>
> Rather, you should use NGX_DONE and increment r->count if you want to wait for an AIO operation result and continue processing yourself.
>
> [...]

Thank you, Maxim, ran a quick test and returning NGX_DONE & r->main->count++ indeed solves the crash.
I'm quite sure that's what my code used to do few years ago, but then I changed it to return NGX_AGAIN,
don't remember why...
Anyway, I will test it more thoroughly and update this thread if anything comes up.

Thanks,

Eran

>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> 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

[nginx] Fixed background requests with asynchronous operations.

Roman Arutyunyan 973 May 29, 2017 04:42PM

RE: [nginx] Fixed background requests with asynchronous operations.

erankor 640 July 24, 2017 06:10AM

Re: [nginx] Fixed background requests with asynchronous operations.

Maxim Dounin 415 July 27, 2017 04:56AM

RE: [nginx] Fixed background requests with asynchronous operations.

erankor 595 July 27, 2017 05:46AM



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

Online Users

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