Created
April 11, 2017 07:10
-
-
Save tskogberg/c7cbd42008f8ec8fd920817a2229cf33 to your computer and use it in GitHub Desktop.
Heroku: Fix "SignalException: SIGHUP" errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
APP_PATH = File.expand_path("../../config/application", __FILE__) | |
require_relative "../config/boot" | |
# Make a clean exit on Heroku while running a rails console. | |
# Without this we'll get a "SignalException: SIGHUP" error in honeybadger. | |
if ENV["DYNO"] | |
if ["c", "console"].include?(ARGV.first) | |
Signal.trap("SIGHUP") { exit 0 } | |
end | |
end | |
require "rails/commands" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I implemented this piece of code in July 2023 on a Rails 6 app (in bin/rails as suggested). It worked nicely. No more errors. But after some time the errors returned. I can see I upgraded to Rails 7 in August 2023 and around this time the errors returned. Possibly related?
I just checked again today:
Rails 7 app, fix code as shown above, implemented in bin/rails
$heroku run rails c
(left alone for 1 hour)
irb(main):001:0> Error: timed out
$heroku logs
...Process exited with status 129
and HoneyBadger reported a SignalException: SIGHUP error