Welcome! Log In Create A New Profile

Advanced

Re: Nginx thread pool is not working in 1.14 in custom module

Maxim Dounin
May 23, 2018 08:34AM
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/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx thread pool is not working in 1.14 in custom module

isolomka May 23, 2018 05:33AM

Re: Nginx thread pool is not working in 1.14 in custom module

Maxim Dounin May 23, 2018 08:34AM

Re: Nginx thread pool is not working in 1.14 in custom module

isolomka May 23, 2018 09:08AM

Re: Nginx thread pool is not working in 1.14 in custom module

Maxim Dounin May 23, 2018 10:30AM

Re: Nginx thread pool is not working in 1.14 in custom module

isolomka May 23, 2018 10:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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