[PATCH] Fixing segfaults in ngx_poll_del_event at worker exit
agentzh
agentzh at gmail.com
Sat Jun 16 03:28:34 UTC 2012
Hello!
On Thu, Jun 14, 2012 at 10:28 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> While the patch obviously fixes the segfault, I don't really like
> it as it leaves incorrect event index set for a copied event.
> It's unlikely this will cause any problems on exit, but it's still
> incorrect.
>
Yeah, it makes sense :)
> Something like this should be better way to solve the problem:
>
> diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
> --- a/src/os/unix/ngx_process_cycle.c
> +++ b/src/os/unix/ngx_process_cycle.c
> @@ -711,6 +711,8 @@ ngx_master_process_exit(ngx_cycle_t *cyc
> ngx_exit_log.file = &ngx_exit_log_file;
>
> ngx_exit_cycle.log = &ngx_exit_log;
> + ngx_exit_cycle.files = ngx_cycle->files;
> + ngx_exit_cycle.files_n = ngx_cycle->files_n;
> ngx_cycle = &ngx_exit_cycle;
>
> ngx_destroy_pool(cycle->pool);
> @@ -1054,6 +1056,8 @@ ngx_worker_process_exit(ngx_cycle_t *cyc
> ngx_exit_log.file = &ngx_exit_log_file;
>
> ngx_exit_cycle.log = &ngx_exit_log;
> + ngx_exit_cycle.files = ngx_cycle->files;
> + ngx_exit_cycle.files_n = ngx_cycle->files_n;
> ngx_cycle = &ngx_exit_cycle;
>
> ngx_destroy_pool(cycle->pool);
>
This patch works for me :)
Thanks!
-agentzh
More information about the nginx-devel
mailing list