Nginx and/or Passenger failing

Sergey A. Osokin osa at FreeBSD.org.ru
Tue Sep 27 08:21:35 UTC 2011


On Tue, Sep 27, 2011 at 03:54:07AM -0400, springbok wrote:
> Hi,
> 
> Envirionment: 
> Passenger 3.0.9 
> nginx 1.0.6 
> Suse SLE 11 
> Rails 3.0.7 
> Ruby 1.9.2 p136 
> Quad core 
> 8 GB 
> Single Rails application 
> 
> nginx settings:
> 
> worker_processes 3;
> worker_rlimit_nofile 8192;
> worker_priority 0;
> events {
>   multi_accept off;
>   worker_connections 4096;
> }
> 
> pid /var/run/nginx.pid;
> error_log  logs/error.log debug;
> http {
>     passenger_root
> /usr/local/rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.9;
>     passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p136/ruby;
>     passenger_max_pool_size 4; 
>     passenger_min_instances 1;
>     keepalive_timeout 180;
>     client_body_buffer_size 128k;
>     client_header_buffer_size 2k;
>     large_client_header_buffers 32 64k;
>     passenger_pool_idle_time 300;
>     passenger_log_level 2;
>     passenger_use_global_queue on;
>     include       /opt/nginx/conf/mime.types;
>     default_type  application/octet-stream;
>     log_format main      '$remote_addr - $remote_user [$time_local]  '
>       '"$request" $status $bytes_sent '
>       '"$http_referer" "$http_user_agent" '
>       '"$gzip_ratio"';
>     access_log  logs/access.log  main;
>     sendfile        on;
>     tcp_nopush        on;
>     tcp_nodelay       off;
>     gzip            on;
>     gzip_http_version 1.0;
>     gzip_comp_level 2;
>     gzip_proxied any;
>     gzip_min_length  1000;
>     gzip_types      text/plain text/css application/x-javascript
> text/xml application/xml application/xml+rss text/javascript;
> ...
> 
> I'm not sure if the problem lies with passenger or nginx, after a period
> of time the passenger as well as the nginx master process shuts down.
> When I look in the log file I have the following:
> 
> 2011/09/27 16:45:36 [info] 6408#0: *204 client 61.88.141.194 closed
> keepalive connection
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:45:46.849 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:46:01.848 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:46:16.848 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:46:31.848 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:46:46.849 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:47:01.849 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:47:16.848 ]: Flushing all sinks (periodic action)
> [ pid=6381 thr=140088026498848
> file=ext/common/LoggingAgent/LoggingServer.h:829 time=2011-09-27
> 16:47:31.848 ]: Flushing all sinks (periodic action)
> [ pid=6371 thr=139975134312192 file=ext/common/Watchdog.cpp:1057
> time=2011-09-27 16:47:38.756 ]: Web server did not exit gracefully,
> forcing shutdown of all service processes...
> 2011/09/27 16:49:00 [crit] 6410#0: *250 connect() to
> unix:/passenger_helper_server failed (2: No such file or directory)
> while connecting to upstream, client: 120.146.194.176, serv
> er: localhost, request: "GET /candidates/new HTTP/1.1", upstream:
> "passenger:unix:/passenger_helper_server:", host: "61.88.141.221",
> referrer: "http://61.88.141.221/home/view_repor
> ts"
> 
> When I look at the running processes the nginx master is no longer
> running but the workers are still running, I have to kill them before I
> can restart. All passenger processes are not longer running.
> 
> As I said I'm not sure which process is causing the other to close and I
> have no idea what the problem may be, so any help greatly appreciated.

Could you try very simple config with small application from passenger
distro, i.e. something like this.

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

    passenger_root /usr/local/rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.9;
    passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p136/ruby;
    passenger_default_user www;

    server {
        listen       127.0.0.1:80;
        server_name  localhost;

        root /usr/local/rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.9/test/stub/rack/public;
        passenger_enabled on;
        passenger_use_global_queue on;
    }
}

After restart your nginx with passenger you should find nginx and passenger
processes.

% ps auxww | grep nginx | grep -v nginx
root   18932  4,0 15,9 44464 39656  ??  Ss    8:46     0:00,01 nginx: master process /usr/local/sbin/nginx
www    18933  4,0 16,0 44464 39904  ??  S     8:46     0:00,02 nginx: worker process (nginx)
% ps uaxww | grep -i passenger | grep -v grep
root   18923  0,0  1,0  5760  2508  ??  Is    8:46     0:00,07 PassengerWatchdog
root   18926  0,0  1,5 15052  3820  ??  I     8:46     0:00,09 PassengerHelperAgent
root   18929  0,0  2,7 13176  6620  ??  I     8:46     0:01,75 ruby: Passenger spawn server (ruby)
nobody 18930  0,0  1,4  6688  3600  ??  I     8:46     0:00,07 PassengerLoggingAgent

% telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
Status: 200
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.9
Server: nginx/1.0.6 + Phusion Passenger 3.0.9 (mod_rails/mod_rack)

hello <b>world</b>Connection closed by foreign host.

Does it possible reproduce your problem for simple configuration?

-- 
Sergey A. Osokin
osa at FreeBSD.ORG.ru
osa at FreeBSD.ORG



More information about the nginx mailing list