Иногда падает nginx???

Igor Sysoev is at rambler-co.ru
Sat May 17 10:56:24 MSD 2008


On Fri, May 16, 2008 at 09:18:36PM +0400, Kirill A. Korinskiy wrote:

> Иногда у меня падает nginx таким вот образом:
> 
> Core was generated by `nginx: worker'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x0000000000423177 in ngx_event_process_posted (cycle=0x598da0, posted=0x58b1f0) at src/event/ngx_event_posted.c:37
> 37              ngx_delete_posted_event(ev);
> (gdb) bt
> #0  0x0000000000423177 in ngx_event_process_posted (cycle=0x598da0, posted=0x58b1f0) at src/event/ngx_event_posted.c:37
> #1  0x000000000042104c in ngx_process_events_and_timers (cycle=0x598da0) at src/event/ngx_event.c:278
> #2  0x000000000042cdeb in ngx_worker_process_cycle (cycle=0x598da0, data=0x0) at src/os/unix/ngx_process_cycle.c:767
> #3  0x0000000000429e50 in ngx_spawn_process (cycle=0x598da0, proc=0x42cc6d <ngx_worker_process_cycle>, data=0x0, name=0x470950 "worker process", 
>     respawn=-2) at src/os/unix/ngx_process.c:187
> #4  0x000000000042bcd5 in ngx_start_worker_processes (cycle=0x598da0, n=4, type=-2) at src/os/unix/ngx_process_cycle.c:332
> #5  0x000000000042b3f9 in ngx_master_process_cycle (cycle=0x598da0) at src/os/unix/ngx_process_cycle.c:124
> #6  0x0000000000402e55 in main (argc=1, argv=0x7fffa9ee7bd8) at src/core/nginx.c:355
> (gdb)
> 
> При этом ev->next и ev->prev есть NULL.
> 
> Если посмотреть на ngx_delete_posted_event то можно видеть:
> 
> #define ngx_delete_posted_event(ev)                                           \
>                                                                               \
>     *(ev->prev) = ev->next;                                                   \
>                                                                               \
>     if (ev->next) {                                                           \
>         ev->next->prev = ev->prev;                                            \
>     }                                                                         \
>                                                                               \
>     ev->prev = NULL;                                                          \
>     ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,                            \
>                    "delete posted event %p", ev);
> 
> И вот мне не совсем понятно, почему тут нет проверки на для ev->prev на NULL?

Потому что, если в этом месте ev->prev == NULL, то это ошибка, а не
нормальная ситуация.


-- 
Игорь Сысоев
http://sysoev.ru





More information about the nginx-ru mailing list