Segfault in 1.0.5.

Igor Sysoev igor at sysoev.ru
Sat Jul 23 09:20:09 UTC 2011


On Sat, Jul 23, 2011 at 03:37:11PM +1000, Nigel Cunningham wrote:
> Hi everyone.
> 
> I'm seeing a segfault in 1.0.5 in worker processes, most reliably caused
> when a visitor attempts to access what is actually an invalid URL
> (index.php/index.php?...). I can however also reproduce it on another
> vhost with valid URLs that fail occasionally and work when you retry.
> 
> The segfault is always in the call to uscf->peer.init(r, uscf) (line 622
> in src/http/ngx_http_upstream.c) and occurs because uscf is not a valid
> pointer. Most of the time it is NULL, but I have also seen it be in the
> low positive integer range. The function itself is working fine, but
> r->upstream->conf->upstream is not getting set right, presumably at
> initialisation time.
> 
> I've done some analysis using GDB, but have spent far too much time on
> this already today, so I'd thought I'd ask here as to whether people
> might have hints as to what I should look at, or a simple patch to test
> that I haven't yet found in Googling.
> 
> The configuration for the vhost that's repeatably segfaulting looks like
> this:
> 
> server { listen 74.207.252.120:81; server_name mtevelyn.crca.org.au;
> rewrite ^(.*) http://www.mtevelyn.crca.org.au:81$1 permanent; }
> 
> server {
>         listen  74.207.252.120:81;
>         server_name  www.mtevelyn.crca.org.au;
> 
>         access_log  /var/log/nginx/mtevelyn.crca.org.au.access.log;
>         error_log /var/log/nginx/mtevelyn.crca.org.au.error.log debug;
> #       error_log /var/log/nginx/mtevelyn.crca.org.au.error.log;
> 
>         large_client_header_buffers 4 8k; # prevent some 400 errors
> 
>         root /home/mtevelyn-website/public_html;
>         index  index.html default.htm index.htm index.php;
> 
>         location / {
>                 expires 30d;
>                 error_page 404 = @joomla;
>                 log_not_found off;
>         }
> 
> #       location /index.php/index.php {
> #               rewrite ^/index.php?q=$1 last;
> #       }
> 
> #       location /index.php {
> #               rewrite ^/index.php/(.*)$ /$1;
> #       }
> 
>         location @joomla {
>                 rewrite ^(.*)$ /index.php?q=$1 last;
>         }
> 
>         # serve static files directly
>         location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
>                 access_log        off;
>                 expires           30d;
>         }
> 
>         location ~ .php$ {
>                 include /etc/nginx/fastcgi_params;
> 
>                 if ($uri !~ "^/images|cache|media/") {
>                         fastcgi_pass 127.0.0.1:9000;
>                 }
> 
>                 if ($uri ~ "^(.+\.php)(/.+)") {
>                         set $script $1;
>                         set $path_info $2;
>                 }
> 
>                 fastcgi_index index.php;
>                 fastcgi_param  SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
>                 fastcgi_param  PATH_INFO        $path_info;
>                 fastcgi_param  QUERY_STRING     $query_string;
>                 fastcgi_param  REQUEST_METHOD   $request_method;
>                 fastcgi_param  CONTENT_TYPE     $content_type;
>                 fastcgi_param  CONTENT_LENGTH   $content_length;
>         }
> }

        root /home/mtevelyn-website/public_html;
        index  index.html default.htm index.htm index.php;

        location / {
                expires 30d;
                error_page 404 = @joomla;
                log_not_found off;
        }

        location @joomla {
                fastcgi_pass 127.0.0.1:9000;
                include /etc/nginx/fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME  $document_root/index.php
                fastcgi_param  QUERY_STRING     $uri;
        }

        # serve static files directly
        location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
                access_log        off;
                expires           30d;
        }

        location ~ ^/(images|cache|media)/ {
                # static
        }

        location ~ (.+\.php)(?<PATH_INFO>/.+)") {
                fastcgi_pass 127.0.0.1:9000;
                include /etc/nginx/fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME 
                               $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO        $path_info;
                fastcgi_param  QUERY_STRING     $query_string;
        }


-- 
Igor Sysoev



More information about the nginx-devel mailing list