mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
When logstash is run without automatic reloading, it is still possible to reload configurations
by using 'SIGHUP'. This functionality was broken in #12444, which split non-terminated pipelines
into "loading" and "running" states. The call `no_pipelines?` in agent#execute would no longer
find pipelines in a "loading" state, causing the loop to exit, and logstash to shutdown. This
commit tests for pipelines in a "loading" state to restore functionality
(cherry picked from commit 7b2bec2e7a
)
Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
This commit is contained in:
parent
2b0193c5a3
commit
8079f0a434
2 changed files with 7 additions and 3 deletions
|
@ -321,7 +321,7 @@ class LogStash::Agent
|
|||
end
|
||||
|
||||
def no_pipeline?
|
||||
@pipelines_registry.running_pipelines.empty?
|
||||
@pipelines_registry.running_pipelines.empty? && @pipelines_registry.loading_pipelines.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -176,7 +176,7 @@ describe LogStash::Agent do
|
|||
|
||||
let(:source_loader) { TestSequenceSourceLoader.new(mock_config_pipeline, mock_second_pipeline_config)}
|
||||
|
||||
it "does upgrade the new config" do
|
||||
it "updates to the new config without stopping logstash" do
|
||||
t = Thread.new { subject.execute }
|
||||
Timeout.timeout(timeout) do
|
||||
sleep(0.1) until subject.running_pipelines_count > 0 && subject.running_pipelines.values.first.ready?
|
||||
|
@ -185,9 +185,13 @@ describe LogStash::Agent do
|
|||
expect(subject.converge_state_and_update).to be_a_successful_converge
|
||||
expect(subject).to have_running_pipeline?(mock_second_pipeline_config)
|
||||
|
||||
# Previously `transition_to_stopped` would be called - the loading pipeline would
|
||||
# not be detected in the `while !Stud.stop?` loop in agent#execute, and the method would
|
||||
# exit prematurely
|
||||
joined = t.join(1)
|
||||
expect(joined).to be(nil)
|
||||
Stud.stop!(t)
|
||||
t.join
|
||||
subject.shutdown
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue