Passenger processes restart, although PassengerPoolIdleTime is 0

I set the PassengerPoolIdleTime value to 0, with the expectation that this means that I can β€œwarm up” a bunch of passenger processes on my server, and the next time I have a traffic packet (even if this happens after a few days) they will all warmed up and ready to accept requests.

What I see is that every morning, when I get up, it passenger-statusshows only a few processes, and all of them were only from midnight. The previous day, I warmed up a bunch of processes, and the last time I looked at passenger-status(until midnight), it was 50.

Here's the whole snippet associated with Passenger from my httpd.conf (I'm on CentOS):

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger 2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /usr/local/bin/ruby
PassengerMaxPoolSize 60
PassengerPoolIdleTime 0

I checked crontabs for root and apache to see if there could be something triggering a restart of apache, but I can't see it.

Here is a snippet passenger-status, about 11 hours and 46 minutes after midnight:

----------- General information -----------
max      = 60
count    = 3
active   = 0
inactive = 3
Waiting on global queue: 0

----------- Domains -----------
/var/www/myapp/current: 
  PID: 20704   Sessions: 0    Processed: 360     Uptime: 11h 44m 16s
  PID: 20706   Sessions: 0    Processed: 4249    Uptime: 11h 44m 9s
  PID: 20708   Sessions: 0    Processed: 14189   Uptime: 11h 44m 9s

And here is what I see if I do ps aux | grep apache:

apache   13297  0.0  0.0 546652  5312 ?        Sl   14:28   0:00 /usr/sbin/httpd.worker
apache   13332  0.0  0.0 546652  5336 ?        Sl   14:28   0:00 /usr/sbin/httpd.worker
apache   13334  0.0  0.0 546652  5328 ?        Sl   14:28   0:00 /usr/sbin/httpd.worker
root     16841  0.0  0.0   6004   628 pts/0    S+   15:48   0:00 grep apache
root     20478  0.0  0.0  88724  3640 ?        Sl   04:02   0:01 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/ApplicationPoolServerExecutable 0 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-spawn-server /usr/local/bin/ruby  /tmp/passenger.30916
apache   20704  0.0  1.7 251080 135164 ?       S    04:02   0:06 Rails: /var/www/apps/myapp/current                                                                                                                                                
apache   20706  0.2  1.7 255188 137704 ?       S    04:02   1:52 Rails: /var/www/apps/myapp/current                                                                                                                                                
apache   20708  0.9  1.7 255180 139332 ?       S    04:02   6:26 Rails: /var/www/apps/myapp/current

The server is in UTC, so 04:02 corresponds to 12:02 my time (EDT).

+3
source share
4 answers

I discovered what was going on. Here is my confrotrotter file for httpd:

/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

This is the postrotat script that does this. Rebooting apache causes passenger processes to die.

Does anyone have any good suggestions on how to do this without restarting apache? Or a way to restart apache without killing passenger processes (if possible)?

0

, , copytruncate . copytruncate , . , . .

/var/log/apache2/*.log {
  weekly
  missingok
  rotate 52
  compress
  delaycompress
  notifempty
  create 640 root adm
  sharedscripts
  copytruncate
  #postrotate
  # /etc/init.d/apache2 reload > /dev/null
  endscript
}
+3

, logrotate...

CustomLog "|/usr/local/bin/my_log_script" combined
+1

The easiest way to logrotate without rebooting / rebooting the service is to use the "copyontruncate" parameter. In this way, logrotate will copy the contents of the log file to another file and clear the current log file. Thus, the service continues to register in a single file, and logrotate does this. For instance:

/var/log/httpd/*log {
    copyontruncate
    missingok
    notifempty
    sharedscripts
}
0
source

Source: https://habr.com/ru/post/1740342/


All Articles