On Thu, 2011-02-10 at 20:05 -0800, Ian Main wrote:
This patch wraps the pipe output in a rescue block so that errors in
this code cannot cause zombie processes as I was seeing in
condor_refreshd.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
src/app/util/condormatic.rb | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/src/app/util/condormatic.rb b/src/app/util/condormatic.rb
index 613430b..533241e 100644
--- a/src/app/util/condormatic.rb
+++ b/src/app/util/condormatic.rb
@@ -235,22 +235,33 @@ def condormatic_classads_sync
pipe = IO.popen("condor_advertise UPDATE_STARTD_AD 2>&1",
"w+")
- pipe.puts "Name=\"provider_combination_#{index}\""
- pipe.puts 'MyType="Machine"'
- pipe.puts 'Requirements=true'
- pipe.puts "\n# Stuff needed to match:"
- pipe.puts
"hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
- pipe.puts "image=\"#{provider_image.image.template.id}\""
- pipe.puts "realm=\"#{realm.frontend_realms[0].id}\""
- pipe.puts "\n# Backend info to complete this job:"
- pipe.puts "image_key=\"#{provider_image.provider_image_key}\""
- pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
- pipe.puts "realm_key=\"#{realm.external_key}\""
- pipe.puts "provider_url=\"#{account.provider.url}\""
- pipe.puts "username=\"#{account.username}\""
- pipe.puts "password=\"#{account.password}\""
- pipe.puts "provider_account_id=\"#{account.id}\""
- pipe.puts "keypair=\"#{escape(account.instance_key.name)}\""
+ # This block should be in an exception because if we bail here the
+ # pipe will not get closed and the process will remain a zombie,
+ # filling the process table for this user making the all of dcloud
+ # fall on its face..
+ begin
+ pipe.puts "Name=\"provider_combination_#{index}\""
+ pipe.puts 'MyType="Machine"'
+ pipe.puts 'Requirements=true'
+ pipe.puts "\n# Stuff needed to match:"
+ pipe.puts
"hardwareprofile=\"#{hwp.aggregator_hardware_profiles[0].id}\""
+ pipe.puts "image=\"#{provider_image.image.template.id}\""
+ pipe.puts "realm=\"#{realm.frontend_realms[0].id}\""
+ pipe.puts "\n# Backend info to complete this job:"
+ pipe.puts
"image_key=\"#{provider_image.provider_image_key}\""
+ pipe.puts "hardwareprofile_key=\"#{hwp.external_key}\""
+ pipe.puts "realm_key=\"#{realm.external_key}\""
+ pipe.puts "provider_url=\"#{account.provider.url}\""
+ pipe.puts "username=\"#{account.username}\""
+ pipe.puts "password=\"#{account.password}\""
+ pipe.puts "provider_account_id=\"#{account.id}\""
+ pipe.puts "keypair=\"#{escape(account.instance_key.name)}\""
+ rescue Exception => ex
+ Rails.logger.error "Error writing provider classad to condor."
+ Rails.logger.error ex.message
+ Rails.logger.error ex.backtrace
+ end
+
pipe.close_write
out = pipe.read
ACK, and ACK to new condor + patch it depends on, not sure it ever made
it to new list.
-j