Last active
January 2, 2016 10:39
-
-
Save ixti/8291386 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| --- a/lib/thin/server.rb 2014-01-06 23:53:11.517120396 +0100 | |
| +++ b/lib/thin/server.rb 2014-01-06 23:54:18.549990835 +0100 | |
| @@ -207,6 +207,17 @@ | |
| def running? | |
| @backend.running? | |
| end | |
| + | |
| + def log_backtrace | |
| + Thread.list.each do |thread| | |
| + log "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}" | |
| + if thread.backtrace | |
| + log thread.backtrace.join("\n") | |
| + else | |
| + log "<no backtrace available>" | |
| + end | |
| + end | |
| + end | |
| protected | |
| # Register signals: | |
| @@ -215,6 +226,7 @@ | |
| def setup_signals | |
| trap('INT') { stop! } | |
| trap('TERM') { stop! } | |
| + trap('USR2') { log_backtrace } | |
| unless Thin.win? | |
| trap('QUIT') { stop } | |
| trap('HUP') { restart } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment