[module dev] PCRE compiled code lost at reload

MAGNIEN, Thierry thierry.magnien at sfr.com
Wed Jun 22 09:31:12 UTC 2016


I'm experiencing a strange behavior and I wonder if I'm missing something obvious...

I've developed a module and I use shared memory and slab allocations to keep data unique across workers and have data survive a reload.

Everything works fine except one single thing: PCRE compiled codes (ngx_regex_compile_t->regex->code).

To be more precise, at reload, in my module init function, I recompile some of the PCRE if they have changed, still using shared memory. What I notice is that, just after init module function has returned, all dying workers lose PCRE compiled code (regex->code = 0), where all new created workers correctly get new compiled code.

I tried to use my own pcre_malloc function in order to be sure memory is allocated in shared memory (and this *is* the case), but without success.

So any help is welcome: does anyone have a clue about why only those data are "lost" by dying workers ?

Thanks a lot for your help,
Thierry Magnien

P.S.: I can't exhibit code for confidentiality reasons but if no one has a clue, I'll try to write a very simple module, only to exhibit this behavior.

More information about the nginx-devel mailing list