Module context become NULL on redirect

Maxim Dounin mdounin at mdounin.ru
Wed Jun 9 14:16:55 MSD 2010


Hello!

On Wed, Jun 09, 2010 at 01:48:10PM +0400, Peter Leonov 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? ;)

Module contexts are cleared on internal redirects, it's expected 
behaviour.  Cleanup has opaque data pointer which should be used 
to provide needed information to cleanup handler.

Maxim Dounin



More information about the nginx-devel mailing list