nginx-0.5.32 crashed

Igor Sysoev is at rambler-co.ru
Thu Nov 8 17:44:19 MSK 2007


On Thu, Oct 11, 2007 at 12:26:38PM +0400, Denis Erygin wrote:

> Примерно раз в день получаю такой coredump:
> 
> GNU gdb 6.1.1 [FreeBSD 5.5]
> This GDB was configured as "i386-marcel-freebsd"...
> Core was generated by `nginx'.
> Program terminated with signal 11, Segmentation fault.
> 
> #0  ngx_palloc (pool=0x8a78000, size=8) at src/core/ngx_palloc.c:115
> 115                     m = ngx_align_ptr(p->last, NGX_ALIGNMENT);
> (gdb) bt
> #0  ngx_palloc (pool=0x8a78000, size=8) at src/core/ngx_palloc.c:115
> #1  0x0804d8b9 in ngx_alloc_chain_link (pool=0x0) at src/core/ngx_buf.c:58
> #2  0x0805b4b6 in ngx_event_pipe_add_free_buf (p=0x8a78710, b=0x8a78688) at src/event/ngx_event_pipe.c:889
> #3  0x0805afa4 in ngx_event_pipe_write_to_downstream (p=0x8a78710) at src/event/ngx_event_pipe.c:631

Возможно, поможет прилагаемый патч.


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/event/ngx_event_pipe.c
===================================================================
--- src/event/ngx_event_pipe.c	(revision 943)
+++ src/event/ngx_event_pipe.c	(working copy)
@@ -421,6 +421,7 @@
 {
     u_char            *prev;
     size_t             bsize;
+    ngx_int_t          rc;
     ngx_uint_t         flush, prev_last_shadow;
     ngx_chain_t       *out, **ll, *cl;
     ngx_connection_t  *downstream;
@@ -451,7 +452,13 @@
                     cl->buf->recycled = 0;
                 }
 
-                if (p->output_filter(p->output_ctx, p->out) == NGX_ERROR) {
+                rc = p->output_filter(p->output_ctx, p->out);
+
+                if (downstream->destroyed) {
+                    return NGX_ABORT;
+                }
+
+                if (rc == NGX_ERROR) {
                     p->downstream_error = 1;
                     return ngx_event_pipe_drain_chains(p);
                 }
@@ -467,12 +474,13 @@
                     cl->buf->recycled = 0;
                 }
 
-                if (p->output_filter(p->output_ctx, p->in) == NGX_ERROR) {
+                rc = p->output_filter(p->output_ctx, p->in);
 
-                    if (downstream->destroyed) {
-                        return NGX_ABORT;
-                    }
+                if (downstream->destroyed) {
+                    return NGX_ABORT;
+                }
 
+                if (rc == NGX_ERROR) {
                     p->downstream_error = 1;
                     return ngx_event_pipe_drain_chains(p);
                 }
@@ -602,7 +610,13 @@
             break;
         }
 
-        if (p->output_filter(p->output_ctx, out) == NGX_ERROR) {
+        rc = p->output_filter(p->output_ctx, out);
+
+        if (downstream->destroyed) {
+            return NGX_ABORT;
+        }
+
+        if (rc == NGX_ERROR) {
             p->downstream_error = 1;
             return ngx_event_pipe_drain_chains(p);
         }


More information about the nginx-ru mailing list