lib/new_relic/agent/agent.rb in newrelic_rpm-6.12.0.367 vs lib/new_relic/agent/agent.rb in newrelic_rpm-6.13.0
- old
+ new
@@ -951,9 +951,13 @@
rescue NewRelic::Agent::LicenseException => e
handle_license_error(e)
rescue NewRelic::Agent::UnrecoverableAgentException => e
handle_unrecoverable_agent_error(e)
rescue StandardError, Timeout::Error, NewRelic::Agent::ServerConnectionException => e
+ # Allow a killed (aborting) thread to continue exiting during shutdown.
+ # See: https://github.com/newrelic/newrelic-ruby-agent/issues/340
+ raise if Thread.current.status == 'aborting'
+
log_error(e)
if opts[:keep_retrying]
note_connect_failure
::NewRelic::Agent.logger.info "Will re-attempt in #{connect_retry_period} seconds"
sleep connect_retry_period