Skip to content

Commit

Permalink
sleep between input/output retries and warn when a major thread is sh…
Browse files Browse the repository at this point in the history
…utting down
  • Loading branch information
fetep committed May 22, 2011
1 parent 72274fb commit 06112f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/logstash/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,13 @@ def run_input(input, queue)
@logger.debug(["Input #{input.to_s} thread exception backtrace",
e.backtrace])
@logger.error("Restarting input #{input.to_s} due to exception")
sleep(1)
retry # This jumps to the top of this proc (to the start of 'do'
end
end

@logger.warn("Input #{input.to_s} shutting down")

# If we get here, the plugin finished, check if we need to shutdown.
shutdown_if_none_running(LogStash::Inputs::Base, queue)
end # def run_input
Expand All @@ -472,6 +475,8 @@ def run_filter(filterworker, index, output_queue)
LogStash::Util::set_thread_name("filter|worker|#{index}")
filterworker.run

@logger.warn("Filter worker ##{index} shutting down")

# If we get here, the plugin finished, check if we need to shutdown.
shutdown_if_none_running(LogStash::FilterWorker, output_queue)
end # def run_filter
Expand All @@ -495,9 +500,12 @@ def run_output(output, queue)
@logger.debug(["Output #{output.to_s} thread exception backtrace",
e.backtrace])
# TODO(sissel): should we abort after too many failures?
sleep(1)
retry
end # begin/rescue

@logger.warn("Output #{input.to_s} shutting down")

# If we get here, the plugin finished, check if we need to shutdown.
shutdown_if_none_running(LogStash::Outputs::Base)
end # def run_output
Expand Down

0 comments on commit 06112f4

Please sign in to comment.