Nginx thread pool is not working in 1.14 in custom module

isolomka nginx-forum at forum.nginx.org
Wed May 23 09:33:51 UTC 2018


Hi,
I have custom nginx module which uses thread pool to serve blocking
synchronous calls to our library.
It worked fine with nginx version 1.12.1.

Now we've tried to upgrade nginx to latest 1.14 version and it seems thread
pool is not working with that version.

After some debugging we've found that the issue is in this commit
https://github.com/nginx/nginx/commit/d1d48ed8448e24ef5297bb37387544ad241591fe

For some reasons, it removed validation if request is blocked (line 2452).
As a result, request is closed before task in thread pool is done. Nginx
crashes with segmentation fault when tries to execute task handler (request
is closed and pool is destroyed):

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005610e5df62b7 in ngx_palloc (pool=0x0, size=80) at
src/core/ngx_palloc.c:126
126	    if (size <= pool->max) {
[Current thread is 1 (Thread 0x7f95ce2f3700 (LWP 23159))]
(gdb) bt
#0  0x00005610e5df62b7 in ngx_palloc (pool=0x0, size=80) at
src/core/ngx_palloc.c:126


Does that mean that using thread pool in custom modules is no longer
supported?
Does any workaround exist to fix it?

Thank you in advance,
Ihor

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,279917,279917#msg-279917



More information about the nginx mailing list