Welcome! Log In Create A New Profile

Advanced

Re: Module context become NULL on redirect

Peter Leonov
June 10, 2010 08:26AM
Hi Matthieu,

On 09.06.2010, at 20:23, Matthieu Tourne wrote:

> Hi Peter,
>
> On Wed, Jun 9, 2010 at 2:48 AM, Peter Leonov <pl@programica.ru> wrote:
>> Hello, devels,
>>
>> got a mysterious crash in a module, that relies on request cleanup hook.
>> In the cleanup handler the module meets its context pointer
>> (via ngx_http_get_module_ctx()) zeroed-out.
>>
>> The redirected request hits other location and I believe
>> that all contexts have to be dropped. But what could the module do
>> if it has some timers set on the redirected request or if the module needs
>> to free some memory allocated somewhere out of the request pool?
>>
>> The only way I see is to double store the context in the cleanup hook.
>> Has somebody such a tricky issue solved this way? ;)
>
> There is an example of a modified internal_redirect function that
> cleans all the contexts, except for the one you want to keep in
> agentzh's chunkin module [1].
> Search for ngx_http_chunkin_internal_redirect() in ngx_http_chunkin_util.c
>
> [1] http://github.com/agentzh/chunkin-nginx-module

Thank you for pointing this out, filling less lonely now :)

Unfortunately, the module was mentioned does define some nginx variables
and their callbacks may and will be invoked at the rewrite stage with a further
redirecting which the module can not control.

So, according to Maxim Dounin, the only way playing with a cleanup callback
data pointer is the only right way to survive the redirect.

Thanks again,
Peter.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Module context become NULL on redirect

Peter Leonov 2596 June 09, 2010 05:58AM

Re: Module context become NULL on redirect

Maxim Dounin 1012 June 09, 2010 06:18AM

Re: Module context become NULL on redirect

Matthieu Tourne 979 June 09, 2010 12:26PM

Re: Module context become NULL on redirect

Peter Leonov 1320 June 10, 2010 08:26AM



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

Online Users

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