Welcome! Log In Create A New Profile

Advanced

Connection memory pool cleanup

Posted by Kukaac 
Connection memory pool cleanup
March 21, 2012 06:03AM
Hi I am working on a nginx module, where I have to manually clean up something from the shared memory when a connection drops.
I am using the following code, to clean my shared memory:

cln = ngx_pool_cleanup_add(r->connection->pool, sizeof(ngx_http_auth_ntlm_cleanup_t));
if (cln == NULL) {
DEBUG("Empty cleanup");
return NULL;
}
cln->handler = ngx_http_auth_ntlm_cleanup;
cleanup = cln->data;
cleanup->shm_zone = shm_zone;
cleanup->node = ctx_node;

It works perfectly when I change the cleanup to r->pool. However with "r->connection->pool" the function ngx_http_auth_ntlm_cleanup is never called, so my modul runs out of memory after about 200 connections. Is there a way to determine when is a connection dropped, so i can clean up the shared memory.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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