Error handling from filter modules
Roman Arutyunyan
arut at nginx.com
Fri Oct 16 18:16:31 UTC 2015
> On 16 Oct 2015, at 15:22, Maxim Dounin <mdounin at mdounin.ru> wrote:
>
> Hello!
>
> On Fri, Oct 16, 2015 at 03:16:23PM +0300, Roman Arutyunyan wrote:
>
>>> So the question is do filters have to manually call
>>> ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); or is it
>>> expected that the upper layers should actually do the right thing and
>>> ensure the client doesn't get a bad response generated from the current
>>> state of r with no indication an error occurred?
>>
>> Calling ngx_http_finalize_request() is the most correct way to return an
>> error from a filter handler. It does some additional cleanup, which can
>> make sense in certain cases.
>
> Huh? The ngx_http_finalize_request() shouldn't be called from
> filters at all, this will cause incorrect reference counting and
> a segmentation fault as a most likely result.
Sorry, of course, I meant ngx_http_filter_finalize_request().
--
Roman Arutyunyan
More information about the nginx-devel
mailing list