Issue #11092 has been reported by Kjetil Torgrim Homme.
----------------------------------------
Feature #11092: when running under --trace, a backtrace from the SIGINT handler
would be useful
https://projects.puppetlabs.com/issues/11092
Author: Kjetil Torgrim Homme
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version:
Keywords:
Branch:
I had an agent just spinning on CPU, seemingly doing nothing. Running under
--debug didn't really tell me anything, and --trace had no effect. It would be
useful if I could get a Ruby backtrace when I pressed ^C.
in my local copy, I changed daemon.rb:set_signal_traps:
<pre>
def set_signal_traps
signals = {:INT => :stop, :TERM => :stop }
# extended signals not supported under windows
signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs
}) unless Puppet.features.microsoft_windows?
signals.each do |signal, method|
Signal.trap(signal) do
Puppet.notice "Caught #{signal}; calling #{method}"
+ if signal == :INT and Puppet[:trace]
+ begin
+ raise Exception.exception("SIG#{signal} received")
+ rescue => detail
+ puts detail.backtrace
+ end
+ end
send(method)
end
end
end
</pre>
This works, but there may be a more elegant way to get hold of a backtrace :-)
You may want to test for Puppet[:debug] as well as Puppet[:trace], but I think
few people will be surprised to see a backtrace when they press ^C in trace
mode.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.