segfault on fs stat

0 views
Skip to first unread message

Daniele Melosi

unread,
May 13, 2010, 5:57:25 AM5/13/10
to ng...@nginx.org
Hi all,

i've a strange problem with an nginx conf.

>From the strace i saw:
[pid 9749] recvfrom(58, "GET /post/18563571/post-via-perl"..., 1024, 0,
NULL, NULL) = 1003
[pid 9749]
stat("/var/www/htdocs/post/18563571/post-via-perl-direttamente-da-new-york",
0x7fff13379840) = -1 ENOENT (No such file or directory)
[pid 9749] --- SIGSEGV (Segmentation fault) @ 0 (0) ---

The related nginx conf is:
if ( !-e $request_filename) {
rewrite ^(.*)$ /blog.php?q=$1 last;
break;
}

_______________________________________________
nginx mailing list
ng...@nginx.org
http://nginx.org/mailman/listinfo/nginx

Igor Sysoev

unread,
May 13, 2010, 6:05:15 AM5/13/10
to ng...@nginx.org
On Thu, May 13, 2010 at 11:57:25AM +0200, Daniele Melosi wrote:

> Hi all,
>
> i've a strange problem with an nginx conf.
>
> >From the strace i saw:
> [pid 9749] recvfrom(58, "GET /post/18563571/post-via-perl"..., 1024, 0,
> NULL, NULL) = 1003
> [pid 9749]
> stat("/var/www/htdocs/post/18563571/post-via-perl-direttamente-da-new-york",
> 0x7fff13379840) = -1 ENOENT (No such file or directory)
> [pid 9749] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>
> The related nginx conf is:
> if ( !-e $request_filename) {
> rewrite ^(.*)$ /blog.php?q=$1 last;
> break;
> }

Try

location / {
try_files $uri /blog.php?q=$uri;
}


--
Igor Sysoev
http://sysoev.ru/en/

Maxim Dounin

unread,
May 13, 2010, 6:30:31 AM5/13/10
to ng...@nginx.org
Hello!

On Thu, May 13, 2010 at 11:57:25AM +0200, Daniele Melosi wrote:

> Hi all,
>
> i've a strange problem with an nginx conf.
>
> >From the strace i saw:
> [pid 9749] recvfrom(58, "GET /post/18563571/post-via-perl"..., 1024, 0,
> NULL, NULL) = 1003
> [pid 9749]
> stat("/var/www/htdocs/post/18563571/post-via-perl-direttamente-da-new-york",
> 0x7fff13379840) = -1 ENOENT (No such file or directory)
> [pid 9749] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>
> The related nginx conf is:
> if ( !-e $request_filename) {
> rewrite ^(.*)$ /blog.php?q=$1 last;
> break;
> }

Igor already provided correct method to do what you want, but it
would be helpfull to debug SIGSEGV as well. Please obtain
coredump and show backtrace, i.e. output of

gdb /path/to/nginx /path/to/nginx.core
bt

Also please show output of nginx -V and full config.

Maxim Dounin
Reply all
Reply to author
Forward
0 new messages