Nginx thread pool is not working in 1.14 in custom module
Maxim Dounin
mdounin at mdounin.ru
Wed May 23 12:33:24 UTC 2018
Hello!
On Wed, May 23, 2018 at 05:33:51AM -0400, isolomka wrote:
> 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?
The the r->blocked check now resides in
ngx_http_terminate_request(), the only way how request can be
closed regardless of its reference counting. If you see problems
in your code introduced by the commit in question, it might
indicate there is something wrong with request reference counting
in your code.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list