seuros / capistrano-puma

Puma integration for Capistrano
https://github.com/seuros/capistrano-puma
MIT License
618 stars 301 forks source link

WatchdogSec causes error when using Type=simple #354

Closed harshalbhakta closed 1 year ago

harshalbhakta commented 1 year ago

I haven't included sd_notify gem in my Gemfile.

# Gemfile
gem 'capistrano', '~> 3.17', '>= 3.17.1', require: false
gem 'capistrano-bundler', '~> 2.1', require: false
gem 'capistrano-rails', '~> 1.6', '>= 1.6.2', require: false
gem 'capistrano-rbenv', '~> 2.2', require: false
gem 'capistrano3-nginx', '~> 3.0', '>= 3.0.4', require: false
gem 'capistrano3-puma', '~> 6.0.0.beta.1', require: false

bundle exec cap production puma:install produces below block in the service file.

[Service]
Type=simple
WatchdogSec=10

When I deploy my code using bundle exec cap production deploy, it shows below error in journalctl.

Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Watchdog timeout (limit 10s)!
Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Killing process 22263 (bundle) with signal SIGABRT.
Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Killing process 22280 (bundle) with signal SIGABRT.
Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Killing process 22283 (bundle) with signal SIGABRT.
Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Main process exited, code=dumped, status=6/ABRT
Dec 05 22:22:07 blog-rails-deployment-1 systemd[20255]: blog_puma_production.service: Failed with result 'watchdog'.

Does WatchdogSec not work with Type=simple? If it doesn't, I think we should add a condition to only add WatchdogSec when service_unit_type is notify. The systemd man page does not specifically say if it will work with Type=simple or not, but it does mention that "The service must call sd_notify(3) regularly with "WATCHDOG=1" (i.e. the "keep-alive ping").". When using Type=simple, sd_notify gem might not be added, is that what is causing the above error?

[Service]
Type=<%= service_unit_type %>

<% if service_unit_type == "notify" %>
WatchdogSec=10
<% end %>
github-actions[bot] commented 1 year ago

Stale issue message

HLFH commented 5 months ago

Reopen?