[module dev] PCRE compiled code lost at reload

MAGNIEN, Thierry thierry.magnien at sfr.com
Wed Jun 22 14:49:36 UTC 2016


Hi,


I think I start understanding what's wrong.

Let me explain what I've done:

I have a ngx_http_mymodule_data_t struct which include this:
ngx_pool_t			*regex_pool;

After initializing my data struct in shared memory, I do something like this:
my_data->regex_pool = ngx_create_pool(REGEX_POOL_SIZE, cycle->log);

Later, at regex compilation, I use this:
my_regex.pool = ((ngx_http_mymodule_data_t *)(sr_shm_zone->data))->regex_pool;

And if I understand correctly, the pool created by ngx_create_pool gets freed. Am I right ?

If so, is there a possibility to use a pool that would survive reload ?

Thanks,
Thierry

________________________________________
De : nginx-devel [nginx-devel-bounces at nginx.org] de la part de Maxim Dounin [mdounin at mdounin.ru]
Envoyé : mercredi 22 juin 2016 16:27
À : nginx-devel at nginx.org
Objet : Re: [module dev] PCRE compiled code lost at reload

Hello!

On Wed, Jun 22, 2016 at 02:21:51PM +0000, MAGNIEN, Thierry wrote:

> Thanks for your response. I already saw that, and that's why I
> use a dedicated pool in shared memory for regex compilation. All
> my ngx_regex_compile_t structs allocate from this unique pool.
> Could pool in shared memory be automatically freed when
> reloading ? And in that case, why would new workers get the
> correct value ? Is there a place where memory is duplicated
> between workers before dying/start of workers ?

There are no pools in shared memory in nginx - except
ngx_slab_pool_t, which is quite different from normal memory
pools and cannot be used in ngx_regex_compile_t.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list