ngx_http_cleanup_add

Dk Jack dnj0496 at gmail.com
Thu Nov 11 03:22:50 UTC 2021


Hi,
In my module, I am allocating some memory for each request and saving the
ptr in my module context. I am registering a callback using
ngx_http_cleanup_add to perform cleanup for each request. I am releasing
the memory for the allocation in the cleanup callback. In the log phase, I
want to make available the contents of the memory I allocated as an nginx
variable.

However, when I try to print this variable in the log, the memory has
already been de-allocated. It looks like the clean-up handlers are called
before the log phase. Since I have released the memory in the cleanup
handler, I have nothing to log in the log phase. Is there a way to defer
the calling of the clean-up handler until after the log phase?

Dk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20211110/88076ec4/attachment.htm>


More information about the nginx-devel mailing list