nginx+fastcgi出现worker process 1297 exited on signal 11

时间:2022-10-27 22:38:52
    各位大神,请帮小弟看看下面的问题:
我使用Nginx服务器+fastcgi,运行cgi程序,nginx一直提示:worker process 1297 exited on signal 11
使用gdb跟踪,发现如下:
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1073840632 (LWP 1305)]
ngx_epoll_process_events (cycle=0x0, timer=1, flags=4)
    at src/event/modules/ngx_epoll_module.c:623
623             rev = c->read;
(gdb) bt
#0  ngx_epoll_process_events (cycle=0x0, timer=1, flags=4)
    at src/event/modules/ngx_epoll_module.c:623
#1  0x000207c0 in ngx_process_events_and_timers (cycle=0x9ad60)
    at src/event/ngx_event.c:248
#2  0x00028218 in ngx_worker_process_cycle (cycle=0x9ad60, data=0x0)
    at src/os/unix/ngx_process_cycle.c:816
#3  0x00025ec4 in ngx_spawn_process (cycle=0x9ad60, 
    proc=0x28148 <ngx_worker_process_cycle>, data=0x0, 
    name=0x76614 "worker process", respawn=0) at src/os/unix/ngx_process.c:198
#4  0x00027ea4 in ngx_reap_children (cycle=0x9ad60)
    at src/os/unix/ngx_process_cycle.c:627
#5  0x000273bc in ngx_master_process_cycle (cycle=0x9ad60)
    at src/os/unix/ngx_process_cycle.c:180
#6  0x0000a520 in main (argc=636384, argv=0xbefffdc4) at src/core/nginx.c:407

如果不调用cgi程序而运行html程序,则一切正常,下面是我的nginx.conf文件:
#user  nobody;
user  nobody nobody;

#same as cpu num;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log   /var/log/nginx/error.log;

pid        logs/nginx.pid;
#pid         /var/run/nginx.pid;

#same as "ulimit -n"
worker_rlimit_nofile 1024;

events {
#use epoll;
        worker_connections  1024;
}

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

        server_names_hash_bucket_size 128;
        client_header_buffer_size 2k;
        large_client_header_buffers 4 4k;
        client_max_body_size 20m; 

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;
        access_log    logs/access.log;

        sendfile        on;
        tcp_nopush      on;

#keepalive_timeout  0;
        keepalive_timeout  60;
        fastcgi_read_timeout 300;

#file cache
        open_file_cache max=1024 inactive=20s;
        open_file_cache_min_uses 1;
        open_file_cache_valid 30s; 

#gzip  on;

        upstream mysvr {
                server 127.0.0.1:15555  weight=6;
        }

        server {
                listen       15555;
#server_name  localhost;
                server_name  127.0.0.1;

#charset koi8-r;

#access_log  logs/host.access.log  main;

                location / {
                        root   /var/www;
                        index  login.cgi;
#allow   192.168.50.0/24;
#deny    all;
                }

# redirect server error pages to the static page /50x.html
#
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                        root   /var/www/;
                }

# proxy the CGI scripts to Nginx listening on 127.0.0.1:9000
#
                location ~ .*\.cgi$ {
                        root   /var/www/;
                        gzip off; 
                        fastcgi_pass 127.0.0.1:9000;
                        fastcgi_index index.cgi;
                        include fastcgi.conf;
                }
        }
}

下面是启动fastcgi命令:
/var/nginx/bin/spawn-fcgi -f /var/nginx/sbin/fcgiwrap -a 127.0.0.1 -p 9000 -F 2 -P /tmp/fastcgi-c.pid -u nobody -g nobody

请各位大神帮忙分析下,谢谢了

2 个解决方案

#1


SIGSEGV

are u sure your cgi script is bug free?

#2


index.cgi内容如下:
#!/bin/sh
echo Content-type: text/html
echo ""
echo Hello, world.

#1


SIGSEGV

are u sure your cgi script is bug free?

#2


index.cgi内容如下:
#!/bin/sh
echo Content-type: text/html
echo ""
echo Hello, world.