passenger_pool_idle_time Not Respected With passenger_spawn_method direct?

79 views
Skip to first unread message

s shaw

unread,
Aug 25, 2016, 10:30:15 PM8/25/16
to phusion-...@googlegroups.com
Passenger 5.0.20. 

I have passenger_pool_idle_time set to 60 (see below) yet passenger-memory-stats shows an idle app running forever. I'm determining it's idle because there are no requests in the application's log. 

Here's my config:

user www-data;
worker_processes 1;
pid /run/nginx.pid;

events {
        worker_connections 768;
}

http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;
        gzip_disable "msie6";

        passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
        passenger_ruby /usr/local/bin/ruby;
        passenger_max_pool_size 2;
        passenger_spawn_method direct;
        passenger_pool_idle_time 60;

        server {
                listen 80;
                server_name example.com

                location / {
                        return 302 http://example.net
                }
        }

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

vhost 1:

server {
listen 443 ssl;
listen [::]:443 ssl;

server_name example.com;

gzip  on;
        gzip_types application/javascript text/css;
        gzip_disable     "msie6";

ssl_certificate      /etc/ssl/certs/example_com.crt;
ssl_certificate_key  /etc/ssl/private/example_com.key;

ssl_session_cache    shared:SSL:1m;
ssl_session_timeout  15m;
ssl_ciphers  HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers  on;

root  /srv/www/foo/public;
passenger_enabled on;

location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
}

vhost 2:

server {
        listen 80;
server_name example.com;
rewrite ^(.*) https://$host$1 permanent;
}

server {
listen 443 ssl;
listen [::]:443 ssl;

server_name  example.com;

ssl_certificate      /etc/ssl/certs/example_com.crt;
ssl_certificate_key  /etc/ssl/private/example_com.key;

ssl_session_cache    shared:SSL:1m;
ssl_session_timeout  15m;
ssl_ciphers  HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers  on;

access_log /srv/www/bar/shared/log/nginx-access.log;
error_log  /srv/www/bar/shared/log/nginx-error.log;

location ~ ^/bar(/.*|$) {
alias /srv/www/bar/current/public$1;

passenger_base_uri /bar;
passenger_app_root /srv/www/bar/current;
passenger_document_root /srv/www/bar/current/public;
passenger_enabled on;

}

location ~ ^/bar/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}

# Just some env var setting
include /etc/nginx/conf.d/bar/env.conf;
}

Daniel Knoppel

unread,
Aug 26, 2016, 5:20:01 AM8/26/16
to Phusion Passenger Discussions
Um, passenger_max_pool_size doesn't have anything to do with timeouts, I guess you mean passenger_pool_idle_time instead.

You have a few config includes for which I don't know what is there (could be conflicting options) but in any case iIt's better to check with passenger-status because it tells you how long the app has really been idle, and if it is maybe stuck while shutting down.

- Daniel

On Friday, August 26, 2016 at 4:30:15 AM UTC+2, s shaw wrote:
Passenger 5.0.20. 

I have passenger_max_pool_size set to 60 (see below) yet passenger-memory-stats shows an idle app running forever. I'm determining it's idle because there are no requests in the application's log. 

s shaw

unread,
Aug 27, 2016, 10:48:00 PM8/27/16
to phusion-...@googlegroups.com
All config files have been included except the ones that contain a bunch of passenger_env_var directives (/etc/nginx/conf.d/*.conf is currently a noop).
 
passenger-status shows a last used time of > 60 seconds for all app groups. One app was last used 2 days ago. 

Camden Narzt

unread,
Aug 31, 2016, 12:43:26 PM8/31/16
to Phusion Passenger Discussions
passenger_min_instances defaults to 1 for each of your apps, and passenger_max_pool_size applies to all applications together (since you have two applications, it effectively forces you to have exactly one process per application).

If you want to drop down to 0 instances per app while idle, you need to set passenger_min_instances to 0.
Reply all
Reply to author
Forward
0 new messages