-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Under a concrete set of circumstances there might be a concurrency problem while processing the /etc/hosts file to setup necessary resolvers. This situation might only happen when the one filter instance is stuck setting up the hosts but this thread and then another instance got kill while waiting, making this tricky so reproduce with a living LS instance.
The condition could be reproduced independently of logstash using https://gist.github.com/purbon/106e80a5d85b3a6fbf1e5f10b5d0d643 code.
The exception reported is:
"exception"=>#<ConcurrencyError: interruptedwaitingformutex: null>,
"backtrace"=>["org/jruby/ext/thread/Mutex.java:94:in `lock'",
"org/jruby/ext/thread/Mutex.java:147:in `synchronize'",
"/opt/logstash/vendor/jruby/lib/ruby/1.9/resolv.rb:190:in `lazy_initialize'",
"/opt/logstash/vendor/jruby/lib/ruby/1.9/resolv.rb:268:in `each_name'",
"/opt/logstash/vendor/jruby/lib/ruby/1.9/resolv.rb:151:in `each_name'",
"org/jruby/RubyArray.java:1613:in `each'",
"/opt/logstash/vendor/jruby/lib/ruby/1.9/resolv.rb:150:in `each_name'",
"/opt/logstash/vendor/jruby/lib/ruby/1.9/resolv.rb:132:in `getname'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:244:in `getname'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:231:in `retriable_getname'",
"org/jruby/RubyProc.java:281:in `call'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:216:in `retriable_request'",
"org/jruby/ext/timeout/Timeout.java:115:in `timeout'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:215:in `retriable_request'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:230:in `retriable_getname'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:178:in `reverse'",
"org/jruby/RubyArray.java:1613:in `each'",
"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-dns-2.1.3/lib/logstash/filters/dns.rb:156:in `reverse'",
This problem is independant of LS code, it has been reported in several different environments see [1] and [2] as examples.
Plan of action:
- There is an upstream issue opened [resolv.rb] ConcurrencyError: interrupted waiting for mutex: null jruby/jruby#4048
- Will wrap the resolv operations under a mutex inside the plugin, this will help making this operation thread safe, but certainly will need proper test by environments that can reproduce this issue inside LS.