> -----Original Message----- > From: nginx-devel [mailto:nginx-devel-boun...@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