From 07ea110f8694b5b3a36fb936e7eaa46a9ce86050 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Fri, 5 Jul 2013 15:01:31 -0700 Subject: Print debug stacktraces from within a forked worker Fixes CHEF-4357: http://tickets.opscode.com/browse/CHEF-4357 Rescue exceptions from within a forker worker and feed them to `Chef::Application.debug_stacktrace()`, then exit non-zero. This fixes an issue where Chef would spew ruby stacktraces with forking enabled (stacktraces should only be printed to console with `-l debug`). Additionally fixes an issue where a generic exception was passed to `debug_stacktrace`, leaving a stacktrace.out file with no useful information. In addition to the above fixes, includes the following improvements: * Update the forked worker's argv0 to clearly indicate it's the worker process, and include ppid and run start time. * When reaping the worker process, include more useful information when the worker exited non-successfully, such as exit code or signal that killed the process. In particular, OOM kill (e.g., when running resource intensive code compile, etc. on small machine) should be a little more obvious. --- lib/chef/application/client.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/chef/application/client.rb') diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 42a7744795..b08a795697 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -316,7 +316,6 @@ class Chef::Application::Client < Chef::Application rescue Exception => e if Chef::Config[:interval] Chef::Log.error("#{e.class}: #{e}") - Chef::Application.debug_stacktrace(e) Chef::Log.error("Sleeping for #{Chef::Config[:interval]} seconds before trying again") unless SELF_PIPE.empty? client_sleep Chef::Config[:interval] @@ -326,7 +325,6 @@ class Chef::Application::Client < Chef::Application end retry else - Chef::Application.debug_stacktrace(e) Chef::Application.fatal!("#{e.class}: #{e.message}", 1) end end -- cgit v1.2.1