Problem with error_handler (redirect loop?)

I’m running into a problem where requests that trigger an error_page
handler get caught in a redirect loop and eventually fail with a 500
response. It looks like this may be related to our server_name being
a regex with captures, as that is what nginx is doing right before the
error output.

The messages in the error log are of the form:

malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
malloc() 18446744073709551614 bytes failed (12: Cannot allocate memory)
rewrite or internal redirection cycle while internal redirect to
"/not_found.html"

It looks like the size that was passed to malloc() was -2 in this case.

Our config:

pid                             /home/brian/tmp/nginx/logs/nginx.pid;
worker_processes        1;
error_log                       /home/brian/tmp/nginx/logs/error.log
debug;


events {
    worker_connections  8192;
}


http {
    include                             mime.types;
    default_type                application/octet-stream;

    log_format                  main   '$host $remote_addr -
$remote_user [$time_local] "$request" '
                                                       '$status
$body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for" $request_time $server_port
$request_length';
    access_log                  /home/brian/tmp/nginx/logs/access.log
main;

    sendfile                    on;
        client_max_body_size    1m;

    keepalive_timeout   65;

        gzip                            on;
        gzip_proxied            any;
        gzip_vary                       on;
        gzip_disable            msie6;
        gzip_http_version       1.1;
        gzip_min_length         256;
        gzip_comp_level         1;
        gzip_types                      text/css text/javascript
text/x-javascript text/json text/x-json text/plain text/xml
                                                application/javascript
application/x-javascript application/json application/x-json
application/xml; # text/html is on by default

        server_name_in_redirect off;

    server {
        listen                  A.B.C.D:8080 default;
                listen                  E.F.G.H:8080 default;
        listen                  I.J.K.L:8080 default;


        server_name             ~^(.)(.)(.).*$;
                set                             $host_1 $1;
                set                             $host_2 $2;
                set                             $host_3 $3;
                set             $www_path
/var/www/app/sites/content;
                set                             $catalyst_path
/usr/local/app/catalyst/root;
                set                             $cache_path
       $catalyst_path/http_cache/$host_1/$host_2$host_3/$host;


                recursive_error_pages   on;
                proxy_intercept_errors  on;
                fastcgi_intercept_errors on;
                error_page                              404
/not_found.html;
                error_page                              500 502 503
/server_error.html;
                location = /not_found.html {
                        internal;
                        root
$catalyst_path/static/errordoc/;
                }
                location = /server_error.html {
                        internal;
                        root
$catalyst_path/static/errordoc/;
                }

                if ( $host ~ ^www\.(.+)$ ) {
                        set $non_www $1;
                        rewrite . http://$non_www$uri permanent;
                }


                location = / {
                        rewrite . http://$host/home.html permanent;
                }
                location = /index.html {
                        rewrite . http://$host/home.html permanent;
                }


                location ^~ /x/ {
                        alias                           $www_path/;
                        log_not_found           off;
                        expires                         10m;
                }


                location ~ \.html$ {
                        root                            $cache_path;
                        expires                         60s;
                        log_not_found           off;
                        error_page                      404 =
@catalyst;
                }
                location = /favicon.ico {
                        root                            $cache_path;
                        expires                         6h;
                        log_not_found           off;
                        error_page                      404 =
@catalyst;
                }
                location = /robots.txt {
                        root                            $cache_path;
                        expires                         6h;
                        log_not_found           off;
                        error_page                      404 =
@catalyst;
                }
                location = /sitemap.xml {
                        root                            $cache_path;
                        expires                         6h;
                        log_not_found           off;
                        error_page                      404 =
@catalyst;
                }
                location = /need_js {
                        root                            $cache_path;
                        expires                         1d;
                        log_not_found           off;
                        error_page                      404 =
@catalyst;
                        default_type            text/html;
                }
                location ^~ /assets/ {
                        include                         fcgi.conf;
                }


                location ^~ /r1 {
                        expires                         max;
                        log_not_found           off;

                        location ~ ^/r\d+/(static/.+)$ {
                                alias
$catalyst_path/$1;
                        }

                        location ~ ^/r\d+/content_cache/.+$ {
                                include                 fcgi.conf;
                        }

                        location ~ ^/r\d+/(cc/.+)$ {
                                alias                   $www_path/$1;
                                error_page              404 =
@catalyst;
                        }

                        location ~ ^/r\d+/(.+)$ {
                                alias                   $cache_path/$1;
                                error_page              404 =
@catalyst;
                        }

                        return 404;
                }


                location ^~ /static/ {
                        root                            $catalyst_path;
                        log_not_found           off;
                }


                location = /resume {
                        include                         fcgi.conf;
                }
                location = /resume.pdf {
                        include                         fcgi.conf;
                }
                location = /message {
                        include                         fcgi.conf;
                }
                location = /dynamic_resources {
                        allow                           127.0.0.1;
                        deny                            all;
                        include                         fcgi.conf;
                }


                location @catalyst {
                        internal;

                        include                         fcgi.conf;
                }


                location ^~ /manage {
                        proxy_pass
http://127.0.0.1:81;
                        proxy_set_header        Host $host;
                        proxy_set_header        X-Forwarded-For
$proxy_add_x_forwarded_for;

                        client_max_body_size 150m;
                }
                location ^~ /content/common/ {
                        root
/var/www/app/sites;
                        expires                         1d;
                        log_not_found           off;
                }


                location / {
                        return 404;
                }
    }
}

Here is the debug log:

2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:6 ev:0001
d:00007F7AC9695010
2010/07/05 15:07:41 [debug] 3379#0: accept on A.B.C.D:8080, ready: 0
2010/07/05 15:07:41 [debug] 3379#0: malloc: 00007F7AC40008C0:256
2010/07/05 15:07:41 [debug] 3379#0: *3 accept: A.B.C.D fd:3
2010/07/05 15:07:41 [debug] 3379#0: *3 event timer add: 3:
60000:1278356921786
2010/07/05 15:07:41 [debug] 3379#0: *3 epoll add event: fd:3 op:1
ev:80000001
2010/07/05 15:07:41 [debug] 3379#0: timer delta: 604592
2010/07/05 15:07:41 [debug] 3379#0: posted events 0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: worker cycle
2010/07/05 15:07:41 [debug] 3379#0: epoll timer: 60000
2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:3 ev:0001
d:00007F7AC96952D1
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC40009D0:1248
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC4000EC0:256
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC4000FD0:1024
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC40013E0:4096
2010/07/05 15:07:41 [debug] 3379#0: *3 http process request line
2010/07/05 15:07:41 [debug] 3379#0: *3 recv: fd:3 75 of 1024
2010/07/05 15:07:41 [debug] 3379#0: *3 http request line: "GET
/r123/splash.jpg HTTP/1.1"
2010/07/05 15:07:41 [debug] 3379#0: *3 http uri: "/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http args: ""
2010/07/05 15:07:41 [debug] 3379#0: *3 http exten: "jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http process request header line
2010/07/05 15:07:41 [debug] 3379#0: *3 http header: "Host: example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http header: "Connection: close"
2010/07/05 15:07:41 [debug] 3379#0: *3 http header done
2010/07/05 15:07:41 [debug] 3379#0: *3 event timer del: 3:
1278356921786
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture: "j"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture: "e"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_2
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture: "n"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_3
2010/07/05 15:07:41 [debug] 3379#0: *3 http script value:
"/var/www/app/sites/content"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $www_path
2010/07/05 15:07:41 [debug] 3379#0: *3 http script value:
"/usr/local/app/catalyst/root"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $catalyst_path
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/usr/local/app/catalyst/root"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "/http_cache/"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "j"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "/"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "e"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "n"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "/"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $cache_path
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script regex: "^www\.(.+)$"
2010/07/05 15:07:41 [notice] 3379#0: *3 "^www\.(.+)$" does not match
"example.com", client: A.B.C.D, server: ~^(.)(.)(.).*$, request: "GET
/r123/splash.jpg HTTP/1.1", host: "example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script if
2010/07/05 15:07:41 [debug] 3379#0: *3 http script if: false
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "/"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "not_found.html"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location:
"server_error.html"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "resume.pdf"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "resume"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "r1"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: ~
"^/r\d+/(static/.+)$"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: ~
"^/r\d+/content_cache/.+$"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: ~
"^/r\d+/(cc/.+)$"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: ~ "^/r\d+/(.+)$"
2010/07/05 15:07:41 [debug] 3379#0: *3 using configuration
"^/r\d+/(.+)$"
2010/07/05 15:07:41 [debug] 3379#0: *3 http cl:-1 max:1048576
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 2
2010/07/05 15:07:41 [debug] 3379#0: *3 post rewrite phase: 3
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 4
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 5
2010/07/05 15:07:41 [debug] 3379#0: *3 access phase: 6
2010/07/05 15:07:41 [debug] 3379#0: *3 access phase: 7
2010/07/05 15:07:41 [debug] 3379#0: *3 post access phase: 8
2010/07/05 15:07:41 [debug] 3379#0: *3 content phase: 9
2010/07/05 15:07:41 [debug] 3379#0: *3 content phase: 10
2010/07/05 15:07:41 [debug] 3379#0: *3 content phase: 11
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/usr/local/app/catalyst/root/http_cache/e/xa/example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "/"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http filename:
"/usr/local/app/catalyst/root/http_cache/e/xa/example.com/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 add cleanup: 00007F7AC40020F8
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/r123/splash.jpg?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 test location: "@catalyst"
2010/07/05 15:07:41 [debug] 3379#0: *3 using location: @catalyst
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 2
2010/07/05 15:07:41 [debug] 3379#0: *3 post rewrite phase: 3
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 4
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 5
2010/07/05 15:07:41 [debug] 3379#0: *3 access phase: 6
2010/07/05 15:07:41 [debug] 3379#0: *3 access phase: 7
2010/07/05 15:07:41 [debug] 3379#0: *3 post access phase: 8
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC40023F0:4096
2010/07/05 15:07:41 [debug] 3379#0: *3 http init upstream, client timer:
0
2010/07/05 15:07:41 [debug] 3379#0: *3 epoll add event: fd:3 op:3
ev:80000005
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "QUERY_STRING"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "QUERY_STRING: "
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"REQUEST_METHOD"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "GET"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "REQUEST_METHOD:
GET"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "CONTENT_TYPE"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "CONTENT_TYPE: "
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"CONTENT_LENGTH"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "CONTENT_LENGTH:
"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "SCRIPT_NAME"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SCRIPT_NAME: "
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "PATH_INFO"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "PATH_INFO:
/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "REQUEST_URI"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "REQUEST_URI:
/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "DOCUMENT_URI"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "DOCUMENT_URI:
/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"DOCUMENT_ROOT"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"/home/brian/tmp/nginx/html"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "DOCUMENT_ROOT:
/home/brian/tmp/nginx/html"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"SERVER_PROTOCOL"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "HTTP/1.1"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SERVER_PROTOCOL:
HTTP/1.1"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"GATEWAY_INTERFACECGI/1.1"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param:
"GATEWAY_INTERFACE: CGI/1.1"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy:
"SERVER_SOFTWARE"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "nginx/"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "0.7.66"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SERVER_SOFTWARE:
nginx/0.7.66"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "REMOTE_ADDR"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "A.B.C.D"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "REMOTE_ADDR:
A.B.C.D"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "REMOTE_PORT"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "50730"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "REMOTE_PORT:
50730"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "SERVER_ADDR"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "A.B.C.D"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SERVER_ADDR:
A.B.C.D"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "SERVER_PORT"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var: "8080"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SERVER_PORT:
8080"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script copy: "SERVER_NAME"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script var:
"~^(.)(.)(.).*$"
2010/07/05 15:07:41 [debug] 3379#0: *3 fastcgi param: "SERVER_NAME:
~^(.)(.)(.).*$"
2010/07/05 15:07:41 [debug] 3379#0: *3 http cleanup add:
00007F7AC4002390
2010/07/05 15:07:41 [debug] 3379#0: *3 get rr peer, try: 1
2010/07/05 15:07:41 [debug] 3379#0: *3 socket 11
2010/07/05 15:07:41 [debug] 3379#0: *3 epoll add connection: fd:11
ev:80000005
2010/07/05 15:07:41 [debug] 3379#0: *3 connect to
unix:/var/lib/apache2/fastcgi/catalyst_fcgi, fd:11 #4
2010/07/05 15:07:41 [debug] 3379#0: *3 connected
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream connect: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream send request
2010/07/05 15:07:41 [debug] 3379#0: *3 chain writer buf fl:0 s:488
2010/07/05 15:07:41 [debug] 3379#0: *3 chain writer in:
00007F7AC40023C8
2010/07/05 15:07:41 [debug] 3379#0: *3 writev: 488
2010/07/05 15:07:41 [debug] 3379#0: *3 chain writer out:
0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: *3 event timer add: 11:
60000:1278356921786
2010/07/05 15:07:41 [debug] 3379#0: timer delta: 0
2010/07/05 15:07:41 [debug] 3379#0: posted events 0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: worker cycle
2010/07/05 15:07:41 [debug] 3379#0: epoll timer: 60000
2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:3 ev:0004
d:00007F7AC96952D1
2010/07/05 15:07:41 [debug] 3379#0: *3 http run request:
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream check client, write
event:1, "/r123/splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream recv(): -1 (11:
Resource temporarily unavailable)
2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:11 ev:0004
d:00007F7AC9695381
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream request:
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream dummy handler
2010/07/05 15:07:41 [debug] 3379#0: timer delta: 0
2010/07/05 15:07:41 [debug] 3379#0: posted events 0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: worker cycle
2010/07/05 15:07:41 [debug] 3379#0: epoll timer: 60000
2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:11 ev:0004
d:00007F7AC9695381
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream request:
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream dummy handler
2010/07/05 15:07:41 [debug] 3379#0: timer delta: 0
2010/07/05 15:07:41 [debug] 3379#0: posted events 0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: worker cycle
2010/07/05 15:07:41 [debug] 3379#0: epoll timer: 60000
2010/07/05 15:07:41 [debug] 3379#0: epoll: fd:11 ev:0005
d:00007F7AC9695381
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream request:
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http upstream process header
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC4003400:4096
2010/07/05 15:07:41 [debug] 3379#0: *3 recv: fd:11 288 of 4096
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 01
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 06
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 00
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 01
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 00
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: FB
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 05
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record byte: 00
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi record length: 251
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header:
"Cache-Control: no-cache, no-store, private, must-revalidate,
max-age=0"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header: "Pragma:
no-cache"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header:
"Content-Length: 36"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header:
"Content-Type: text/html; charset=utf-8"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header: "Expires:
Mon, 05 Jul 2010 19:07:41 GMT"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header: "Status: 404
Not Found"
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi parser: 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http fastcgi header done
2010/07/05 15:07:41 [debug] 3379#0: *3 finalize http upstream request:
404
2010/07/05 15:07:41 [debug] 3379#0: *3 finalize http fastcgi request
2010/07/05 15:07:41 [debug] 3379#0: *3 free rr peer 1 0
2010/07/05 15:07:41 [debug] 3379#0: *3 close http upstream connection:
11
2010/07/05 15:07:41 [debug] 3379#0: *3 event timer del: 11:
1278356921786
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/r123/splash.jpg?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/r123/splash.jpg?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc: 00007F7AC4004410:4096
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 internal redirect:
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 generic phase: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [debug] 3379#0: *3 http script capture:
"splash.jpg"
2010/07/05 15:07:41 [debug] 3379#0: *3 http script set $host_1
2010/07/05 15:07:41 [debug] 3379#0: *3 http script complex value
2010/07/05 15:07:41 [emerg] 3379#0: *3 malloc() 18446744073709551614
bytes failed (12: Cannot allocate memory), client: A.B.C.D, server:
~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1", upstream:
"fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:", host:
"example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 malloc:
0000000000000000:18446744073709551614
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 404,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 404,
"/not_found.html?"
2010/07/05 15:07:41 [error] 3379#0: *3 rewrite or internal redirection
cycle while internal redirect to "/not_found.html", client: A.B.C.D,
server: ~^(.)(.)(.).*$, request: "GET /r123/splash.jpg HTTP/1.1",
upstream: "fastcgi://unix:/var/lib/apache2/fastcgi/catalyst_fcgi:",
host: "example.com"
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 500,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http special response: 500,
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http set discard body
2010/07/05 15:07:41 [debug] 3379#0: *3 HTTP/1.1 500 Internal Server
Error
Server: nginx/0.7.66
Date: Mon, 05 Jul 2010 19:07:41 GMT
Content-Type: text/html
Content-Length: 193
Connection: close

2010/07/05 15:07:41 [debug] 3379#0: *3 write new buf t:1 f:0
00007F7AC40046A0, pos 00007F7AC40046A0, size: 162 file: 0, size: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http write filter: l:0 f:0 s:162
2010/07/05 15:07:41 [debug] 3379#0: *3 http output filter
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 copy filter: "/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http postpone filter
"/not_found.html?" 00007F7AC4004868
2010/07/05 15:07:41 [debug] 3379#0: *3 write old buf t:1 f:0
00007F7AC40046A0, pos 00007F7AC40046A0, size: 162 file: 0, size: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 write new buf t:0 f:0
0000000000000000, pos 00000000006763E0, size: 140 file: 0, size: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 write new buf t:0 f:0
0000000000000000, pos 00000000006754E0, size: 53 file: 0, size: 0
2010/07/05 15:07:41 [debug] 3379#0: *3 http write filter: l:1 f:0 s:355
2010/07/05 15:07:41 [debug] 3379#0: *3 http write filter limit 0
2010/07/05 15:07:41 [debug] 3379#0: *3 writev: 355
2010/07/05 15:07:41 [debug] 3379#0: *3 http write filter
0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: *3 copy filter: 0
"/not_found.html?"
2010/07/05 15:07:41 [debug] 3379#0: *3 http finalize request: 0,
"/not_found.html?" 1
2010/07/05 15:07:41 [debug] 3379#0: *3 http close request
2010/07/05 15:07:41 [debug] 3379#0: *3 http log handler
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC4003400
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC40013E0, unused:
8
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC40023F0, unused:
0
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC4004410, unused:
2736
2010/07/05 15:07:41 [debug] 3379#0: *3 close http connection: 3
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC4000FD0
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC40009D0
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC40008C0, unused:
8
2010/07/05 15:07:41 [debug] 3379#0: *3 free: 00007F7AC4000EC0, unused:
128
2010/07/05 15:07:41 [debug] 3379#0: timer delta: 4
2010/07/05 15:07:41 [debug] 3379#0: posted events 0000000000000000
2010/07/05 15:07:41 [debug] 3379#0: worker cycle
2010/07/05 15:07:41 [debug] 3379#0: epoll timer: -1

Thanks!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,105623,105623#msg-105623