Segfault in nginx 1.0.5

Hi guys,

I’m seeing a small segfault in 1.0.5

It is strage there is something triggering it as it happens at the same
time every night. It isn’t triggered by crontab as I have nothing that
runs at that time.
I’m running the keepalive patch (however this was happening before I
installed it).

Anyway here is the backtrace

#0 0x00007fd02a58cc9e in memcpy () from /lib/libc.so.6
#1 0x000000000049fb4c in ngx_http_proxy_create_request (r=0x19f3d80) at
src/http/modules/ngx_http_proxy_module.c:1021
#2 0x0000000000470a2b in ngx_http_upstream_init_request (r=0x19f3d80)
at src/http/ngx_http_upstream.c:497
#3 0x0000000000470868 in ngx_http_upstream_init (r=0x19f3d80) at
src/http/ngx_http_upstream.c:438
#4 0x0000000000466f5c in ngx_http_read_client_request_body
(r=0x19f3d80, post_handler=0x470775 <ngx_http_upstream_init>)
at src/http/ngx_http_request_body.c:58
#5 0x000000000049eb49 in ngx_http_proxy_handler (r=0x19f3d80) at
src/http/modules/ngx_http_proxy_module.c:655
#6 0x000000000044f19b in ngx_http_core_content_phase (r=0x19f3d80,
ph=0x1a07a60) at src/http/ngx_http_core_module.c:1339
#7 0x000000000044ddc4 in ngx_http_core_run_phases (r=0x19f3d80) at
src/http/ngx_http_core_module.c:837
#8 0x000000000044dd3b in ngx_http_handler (r=0x19f3d80) at
src/http/ngx_http_core_module.c:820
#9 0x000000000045159d in ngx_http_internal_redirect (r=0x19f3d80,
uri=0x7fff40c440f0, args=0x7fff40c440e0)
at src/http/ngx_http_core_module.c:2347
#10 0x0000000000457836 in ngx_http_send_error_page (r=0x19f3d80,
err_page=0x19b3168) at src/http/ngx_http_special_response.c:560
#11 0x0000000000457430 in ngx_http_special_response_handler
(r=0x19f3d80, error=400) at src/http/ngx_http_special_response.c:402
#12 0x000000000045c31d in ngx_http_finalize_request (r=0x19f3d80,
rc=400) at src/http/ngx_http_request.c:1944
#13 0x0000000000459bfe in ngx_http_process_request_line
(rev=0x7fd029684de0) at src/http/ngx_http_request.c:907
#14 0x0000000000458ebe in ngx_http_init_request (rev=0x7fd029684de0) at
src/http/ngx_http_request.c:521
#15 0x00000000004368e1 in ngx_event_process_posted (cycle=0x18d4d60,
posted=0x6de408) at src/event/ngx_event_posted.c:39
#16 0x000000000043467c in ngx_process_events_and_timers
(cycle=0x18d4d60) at src/event/ngx_event.c:272
#17 0x000000000044165d in ngx_worker_process_cycle (cycle=0x18d4d60,
data=0x0) at src/os/unix/ngx_process_cycle.c:800
#18 0x000000000043e146 in ngx_spawn_process (cycle=0x18d4d60,
proc=0x4414a1 <ngx_worker_process_cycle>, data=0x0,
name=0x4b5583 “worker process”, respawn=-3) at
src/os/unix/ngx_process.c:196
#19 0x00000000004404b4 in ngx_start_worker_processes (cycle=0x18d4d60,
n=14, type=-3) at src/os/unix/ngx_process_cycle.c:360
#20 0x000000000043fb0c in ngx_master_process_cycle (cycle=0x18d4d60) at
src/os/unix/ngx_process_cycle.c:136
#21 0x000000000040fd89 in main (argc=1, argv=0x7fff40c448b8) at
src/core/nginx.c:405

Hello!

On Mon, Aug 08, 2011 at 01:50:12AM +0000, Kingsley F. wrote:

#9 0x000000000045159d in ngx_http_internal_redirect (r=0x19f3d80,
uri=0x7fff40c440f0, args=0x7fff40c440e0)
at src/http/ngx_http_core_module.c:2347
#10 0x0000000000457836 in ngx_http_send_error_page (r=0x19f3d80,
err_page=0x19b3168) at src/http/ngx_http_special_response.c:560
#11 0x0000000000457430 in ngx_http_special_response_handler (r=0x19f3d80,
error=400) at src/http/ngx_http_special_response.c:402
#12 0x000000000045c31d in ngx_http_finalize_request (r=0x19f3d80, rc=400) at
src/http/ngx_http_request.c:1944
#13 0x0000000000459bfe in ngx_http_process_request_line (rev=0x7fd029684de0) at
src/http/ngx_http_request.c:907

Could you please show your config? It looks like you are using
something like

error_page  400  @fallback;

location @fallback {
    proxy_pass ...
}

in it.

This is obviously a bug, though you may easily avoid triggering it
by not intercepting error page 400.

Maxim D.

Would something like this do it?

            error_page 403 404 /error.html;

            location /error.html {
                    set $args "";
                    proxy_pass http://squid/;
                    internal;
            }

Kingsley

Wait someone put one of these in another file

error_page 400 403 404 /error.html;

            location /error.html {
                    set $args "";
                    proxy_pass http://squid/;
                    internal;
            }

I’m assuming that could be it, if it is ill remove it

Kingsley

Hello!

On Mon, Aug 08, 2011 at 06:43:35AM +0000, Kingsley F. wrote:

Would something like this do it?

            error_page 403 404 /error.html;

This problem is specific to error_page 400, as 400 means “bad
request” and request may not have some required parts set (due to
being actually bad).

Maxim D.

Thanks Maxim,

A++ for the help (and the keepalive patch)

Hi,

Am 08.08.2011 08:48, schrieb Maxim D.:

This problem is specific to error_page 400, as 400 means “bad
request” and request may not have some required parts set (due to
being actually bad).

but in this case an error or warning or whatsoever would be better
than just a segfault, right? :wink:

Don’t want to bug at it, i just think that catching such config
problems would be good for the future (and as i’m not a coder
in general, i cannot fix it by myself…).

Regards,
Sven

Hello!

On Mon, Aug 08, 2011 at 09:41:11AM +0200, Sven ‘Darkman’ Michels wrote:

Don’t want to bug at it, i just think that catching such config
problems would be good for the future (and as i’m not a coder
in general, i cannot fix it by myself…).

I specifically outlined in my original reply that this is a bug
(and it obviously needs fixing).

Maxim D.