Skip to content

Infinite loop when pipeline stopping #71

@thales-hawk

Description

@thales-hawk

Logstash information:

  1. Logstash version: Tested in 7.16, 7.17 and 8.1
  2. Logstash installation source: From tar gz
  3. How is Logstash being run: Command line
  4. How was the Logstash Plugin installed: Installed by default in the tar package

JVM (e.g. java -version): Packaged version

OS version (uname -a if on a Unix-like system): 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:

Issue detected by using the input file. The input file seems to use the identity_map_codec from multiline codec.
The problem is sometimes a pipeline never stop. I analysed the issue by adding some logs and I notice that the pipeline is trapped in an infinite loop. This loop is located in the identity_map_codec.rb file in the stop method of the PeriodicRunner class:

def stop
      return if !running?
      @running.make_false
      while @thread.alive?
        begin
          @thread.wakeup
        rescue ThreadError
          # thread might drop dead since the alive? check
        else
          puts "Before join"
          @thread.join(0.1) # raises $! if there was any
          puts "After join"
        end
      end
      @listener = nil
    end

The cause of the loop is the @running variable which is never changed to false. Unfortunately, I don't understand why the boolean stay to true :-(

Steps to reproduce:

This issue is random and so tricky to reproduce. I just create a pipeline in logstash with the file input and remove it from the pipeline.yml config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions