signal 11, FreeBSD 6.1

Igor Sysoev is at rambler-co.ru
Fri Feb 9 14:55:14 MSK 2007


On Fri, Feb 09, 2007 at 03:31:55PM +0600, zevvs at ttb.ru wrote:
> Добрый день. nginx постоянно падает (раз в 1-2 минуты) с 11 сигналом.
> Вывод дебагера:

> #0  0x08082a6e in ngx_http_fastcgi_script_name_variable (r=0x80a9000, v=0x80b6288, data=0)
>     at src/http/modules/ngx_http_fastcgi_module.c:1978
> 1978        if (r->uri.data[r->uri.len - 1] != '/') {
> (gdb) bt

Патч


-- 
Игорь Сысоев
http://sysoev.ru
-------------- next part --------------
Index: src/http/modules/ngx_http_fastcgi_module.c
===================================================================
--- src/http/modules/ngx_http_fastcgi_module.c	(revision 416)
+++ src/http/modules/ngx_http_fastcgi_module.c	(working copy)
@@ -1969,28 +1969,39 @@
     u_char                       *p;
     ngx_http_fastcgi_loc_conf_t  *flcf;
 
-    v->valid = 1;
-    v->no_cachable = 0;
-    v->not_found = 0;
+    if (r->uri.len) {
+        v->valid = 1;
+        v->no_cachable = 0;
+        v->not_found = 0;
 
-    flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
+        flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
 
-    if (r->uri.data[r->uri.len - 1] != '/') {
-        v->len = r->uri.len;
-        v->data = r->uri.data;
-        return NGX_OK;
-    }
+        if (r->uri.data[r->uri.len - 1] != '/') {
+            v->len = r->uri.len;
+            v->data = r->uri.data;
+            return NGX_OK;
+        }
 
-    v->len = r->uri.len + flcf->index.len;
+        v->len = r->uri.len + flcf->index.len;
 
-    v->data = ngx_palloc(r->pool, v->len);
-    if (v->data == NULL) {
-        return NGX_ERROR;
+        v->data = ngx_palloc(r->pool, v->len);
+        if (v->data == NULL) {
+            return NGX_ERROR;
+        }
+
+        p = ngx_copy(v->data, r->uri.data, r->uri.len);
+        ngx_memcpy(p, flcf->index.data, flcf->index.len);
+
+    } else {
+        v->len = 0;
+        v->valid = 1;
+        v->no_cachable = 0;
+        v->not_found = 0;
+        v->data = NULL;
+
+        return NGX_OK;
     }
 
-    p = ngx_copy(v->data, r->uri.data, r->uri.len);
-    ngx_memcpy(p, flcf->index.data, flcf->index.len);
-
     return NGX_OK;
 }
 


More information about the nginx-ru mailing list