logstash-plugins / logstash-codec-multiline

Apache License 2.0
7 stars 31 forks source link

Logstash Crashing, v. 2.1.3, undefined method `map_cleanup' for nil:NilClass #32

Closed ghost closed 6 years ago

ghost commented 8 years ago

NoMethodError: undefined method `map_cleanup' for nil:NilClass start at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-multiline-2.0.9/lib/logstash/codecs/identity_map_codec.rb:55

I diffed my current version with the following library hosted on github, seems up to date.

magicdude4eva commented 8 years ago

Same issue - installed via repo on centos:

NoMethodError: undefined method `map_cleanup' for nil:NilClass
  start at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-multiline-2.0.11/lib/logstash/codecs/identity_map_codec.rb:55
coder-hugo commented 8 years ago

Same here. For some reason the @listener in https://github.com/logstash-plugins/logstash-codec-multiline/blob/master/lib/logstash/codecs/identity_map_codec.rb#L55 is nil. This should just happen within the stop method. But in this case @running should be false and the code @listener.send(@method_symbol) shouldn't be reached. As a workaround we patched the file with an nil check before performing @listener.send(@method_symbol).

ph commented 8 years ago

@coder-hugo you are right, this shouldn't happen, but you are using this codec with what input?

coder-hugo commented 8 years ago

@ph we are using the file input which uses the IdentityMapCodec in line 230.

guyboertje commented 8 years ago

This would appear to be a race condition during shutdown. I think the nil check is a reasonable solution.

Will implement.

elwesingollo commented 8 years ago

Hi @coder-hugo what is the exact solution applied?

coder-hugo commented 8 years ago

@elwesingollo We patched the file as follows:

--- /tmp/identity_map_codec.rb  2016-04-27 14:59:44.560814581 +0200
+++ /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-multiline-2.0.11/lib/logstash/codecs/identity_map_codec.rb    2016-04-27 15:02:00.249239046 +0200
@@ -52,7 +52,7 @@
         while running? do
           sleep @interval
           break if !running?
-          @listener.send(@method_symbol)
+          @listener.send(@method_symbol) unless @listener.nil?
         end
       end
       self
chaturvedia commented 7 years ago

I ran into this issue on ES 2.3.4. Which release is this expected to be fixed? At the time this happened there is no log entry that logstash was processing so puzzled at what is the root cause

espressobeanies commented 7 years ago

I can confirm this issue is still present in the latest ES v2.4.1.

NoMethodError: undefined method `map_cleanup' for nil:NilClass start at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-multiline-2.0.11/lib/logstash/codecs/identity_map_codec.rb:55

"current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/output_delegator.rb:128:in `pop'"}]}>, :level=>:warn}

idubinskiy commented 7 years ago

@coder-hugo Have you tried submitting that fix as a pull request?

We're seeing this exact issue, too. Wondering if that fix worked for anyone else.

guyboertje commented 7 years ago

@idubinskiy - Are you seeing this issue at shutdown only or while general running of Logstash?

gengwg commented 7 years ago

Confirmed this issue exits in logstash 2.4.0.

That patch seems work so far, but not totally sure, since it only occurs on some of our nodes, not all of them.

Let us know when this is fixed, so that we can upgrade our Logstash.

guyboertje commented 7 years ago

@gengwg - Are you seeing this issue at shutdown only or while general running of Logstash?

gengwg commented 7 years ago

@guyboertje It's seen after issuing restart of logstash, so I guess it's shutdown.

guyboertje commented 7 years ago

@gengwg - Got it, thanks.

ryandonahue commented 7 years ago

Any progress on this?

simjaemun2 commented 7 years ago

hello, I've got below error message, logstash ver. 5.4.0

[2017-06-28T04:06:35,862][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<NoMethodError: undefined method map_cleanup' for nil:NilClass>, :backtrace=>["/snap/local/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-multiline-3.0.3/lib/logstash/codecs/identity_map_codec.rb:55:instart'"]}

brandondash commented 7 years ago

Searches are telling me this has been a problem since at least March 2016. I can confirm it just happened to me this morning with Logstash 5.x. Is there anything we in the community can do to help move this along?

djromy2006 commented 7 years ago

@coder-hugo can you describe the step to run the patch? Thanks

coder-hugo commented 7 years ago

@djromy2006 you just have to apply the patch of my comment to the identity_map_codec.rb file of your logstash installation. `

djromy2006 commented 7 years ago

I got it thank you! I will apply it and see how it works for me. Thanks!