Opened 7 years ago

Closed 7 years ago

#1366 closed defect (wontfix)

ngx_epoll_notify override original handler

Reported by: yuguang.hu.vnner.com@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.12.x
Keywords: ngx_epoll_notify Cc:
uname -a:
nginx -V: nginx version: nginx/1.12.1
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
configure arguments: --add-module=./third_part_module/echo --with-debug --with-cc-opt='-O0 -g' --prefix=./prefix

Description

static ngx_int_t
ngx_epoll_notify(ngx_event_handler_pt handler)
{

static uint64_t inc = 1;

notify_event.data = handler;
...

}

If two modules call ngx_notify(handler), the notify_event.data will be overwrite.

Maybe the notify_event->data should be a pointer which point to a function pointer array?

Now only ngx_thread_pool call ngx_notify, so I wondered if 3rd part modules (which have their own thread pool) can call it.

If ngx_notify do not want 3rd part modules call it, that is, only ngx_thread_pool can call it, maybe a better way is let ngx_epoll_notify do not has parameter and set the ngx_thread_pool_handler through ngx_epoll_init?

ps: My ngx version is 1.12, I check the latest code(1.13.x), the related code is same.

Change History (2)

comment:1 by yuguang.hu.vnner.com@…, 7 years ago

I am so sorry, the title should be "ngx_epoll_notify overwrite original handler". Please forgive my poor English.

comment:2 by Maxim Dounin, 7 years ago

Resolution: wontfix
Status: newclosed

As of now, only thread pools are expected to use ngx_notify(). Alternatively, you can develop your own thread pools implementation and use it instead. The problem will arise if you'll try to use two implementations simultaneously, this is not something currently supported.

Note: See TracTickets for help on using tickets.