puma server silently crashes in production without

2019-08-22 06:49发布

问题:

Time to time when i access the production site the site is down. I dont know how much time it has been down for. I then ssh to the production server and check the logs and the logs has no record of when the puma was down.

I do grep 'puma shutdown:' puma.error.log to see all instances of when puma was shutdown

=== puma shutdown: 2018-03-18 15:44:20 +0545 ===
=== puma shutdown: 2018-04-27 15:22:14 +0545 ===
=== puma shutdown: 2018-04-28 18:27:26 +0545 ===
=== puma shutdown: 2018-05-08 17:45:37 +0545 ===
=== puma shutdown: 2018-05-11 07:05:40 +0545 ===

Now the latest date is was down was between 2018-07-27 to 2018-07-29. But you ca see above that there is no record of month 7.

After i find the puma app crashed i need to redeploy using capistrano.

cap production deploy

At the end it shows that puma has been started. This confirms that puma was down.

02:10 puma:start
      using conf file /home/deploy/apps/app/shared/puma.rb
      01 ~/.rvm/bin/rvm default do bundle exec puma -C /home/deploy/apps/app/shared/puma.rb --daemon
      01 Puma starting in single mode...
      01
      01 * Version 3.11.0 (ruby 2.4.2-p198), codename: Love Song
      01
      01 * Min threads: 4, max threads: 16
      01
      01 * Environment: production
      01
      01 * Daemonizing...
      01

I have checked /var/log/syslog and since it has only record of few hours i dont see any indication of puma getting killed by system.

So i need help to understand what could be the cause of puma being silently shutdown in production? Thanks for help. Also i don't think this is memory issue because most of the time when i do free -m the free memory shown is around 1 gb. Thanks!