Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Catch exceptions inside blocks passed to fiber pools.

Uncaught exceptions cause the fiber to be removed from the pool. If enough
of these are thrown, the pool is exhausted and newly queued blocks will
never run, thus creating a leak.

Change-Id: I343afb5476d713205016482284d3438b83c05324
  • Loading branch information...
commit 2e1bedfb00cc022a24542af81860d8dc97dcd773 1 parent 3d6883e
mpage authored
View
15 cloud_controller/app/subscriptions/dea_advertise_channel.rb
@@ -3,12 +3,19 @@
NATS.subscribe('dea.advertise') do |msg|
begin
payload = Yajl::Parser.parse(msg, :symbolize_keys => true)
- CloudController::UTILITY_FIBER_POOL.spawn do
- DEAPool.process_advertise_message(payload)
- end
rescue => e
- CloudController.logger.error("Exception processing dea advertisement: '#{msg}'")
+ CloudController.logger.error("Failed parsing DEA advertisement #{msg} : #{e}")
CloudController.logger.error(e)
+ next
+ end
+
+ CloudController::UTILITY_FIBER_POOL.spawn do
+ begin
+ DEAPool.process_advertise_message(payload)
+ rescue => e
+ CloudController.logger.error("Failed processing dea advertisement: '#{msg}'")
+ CloudController.logger.error(e)
+ end
end
end
NATS.publish('dea.locate')
View
15 cloud_controller/app/subscriptions/health_manager_channel.rb
@@ -12,12 +12,19 @@
NATS.subscribe("cloudcontrollers.hm.requests.#{AppConfig[:cc_partition]}", :queue => :cc) do |msg|
begin
payload = Yajl::Parser.parse(msg, :symbolize_keys => true)
- CloudController::UTILITY_FIBER_POOL.spawn do
- App.process_health_manager_message(payload)
- end
rescue => e
- CloudController.logger.error("Exception processing health manager request: '#{msg}'")
+ CloudController.logger.error("Failed parsing HM request #{msg} : #{e}")
CloudController.logger.error(e)
+ next
+ end
+
+ CloudController::UTILITY_FIBER_POOL.spawn do
+ begin
+ App.process_health_manager_message(payload)
+ rescue => e
+ CloudController.logger.error("Failed processing HM request #{msg}: #{e}")
+ CloudController.logger.error(e)
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.