logstash-plugins / logstash-output-stomp

Apache License 2.0
4 stars 13 forks source link

Many Errors/Warnings around the Use of Thread.exclusive being Logged when Used with LS 6.x #19

Open original-brownbear opened 7 years ago

original-brownbear commented 7 years ago

Running this plugin with LS 6.x results in the following error being logged for seemingly every event:

Thread.exclusive is deprecated, use Mutex
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp.rb:121:in `next_serial'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes/transaction_scope.rb:189:in `next_transaction_id'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes/transaction_scope.rb:47:in `begin_with_transaction'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes/transaction_scope.rb:160:in `perform'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes.rb:24:in `block in transaction'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes.rb:23:in `tap'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.9/lib/onstomp/components/scopes.rb:23:in `transaction'
/Users/brownbear/src/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-stomp-3.0.7/lib/logstash/outputs/stomp.rb:77:in `multi_receive'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/output_delegator_strategies/legacy.rb:22:in `multi_receive'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/output_delegator.rb:49:in `multi_receive'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/pipeline.rb:536:in `block in output_batch'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/pipeline.rb:535:in `each'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/pipeline.rb:535:in `output_batch'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/pipeline.rb:481:in `worker_loop'
/Users/brownbear/src/logstash/logstash-core/lib/logstash/pipeline.rb:437:in `block in start_workers'
Thread.exclusive is deprecated, use Mutex

Looks like JRuby 9k changed/deprecated something that we should adjust for :)

robin13 commented 7 years ago

This diff based on (here) to onstomp.rb seems to fix:

-bash-4.2$ diff -Naur onstomp.rb_SAVE onstomp.rb
--- onstomp.rb_SAVE    2017-10-24 09:53:56.365580722 +0200
+++ onstomp.rb 2017-10-24 09:54:59.629782201 +0200
@@ -87,6 +87,7 @@
  class StopReceiver < StandardError; end

  class << self
+   SEMAPHORE = Mutex.new
    # Creates a new connection and immediately connects it to the broker.
    # @see #initialize
    def connect(uri, options={})
@@ -118,7 +119,8 @@
    # merely initializes an instance variable to 0 if it has not been set,
    # then increments this value and returns its string representation.
    def next_serial(prefix=nil)
-     Thread.exclusive do
+     # Thread.exclusive do
+     SEMAPHORE.synchronize do
        @next_serial_sequence ||= 0
        @next_serial_sequence += 1
        @next_serial_sequence.to_s
smartkathycat commented 5 years ago

One user ran into the same issue here. Is this bug been worked on a fix?

Error message:

[2019-02-22T10:11:56,725][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
Thread.exclusive is deprecated, use Mutex
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp.rb:121:in `next_serial'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:189:in `next_transaction_id'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:47:in `begin_with_transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:160:in `perform'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:24:in `block in transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `tap'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/logstash-output-stomp-3.0.9/lib/logstash/outputs/stomp.rb:77:in `multi_receive'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:475:in `multi_receive'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:475:in `block in output_batch'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:474:in `each'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:474:in `output_batch'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:426:in `worker_loop'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:384:in `block in start_workers'
Thread.exclusive is deprecated, use Mutex
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp.rb:121:in `next_serial'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:189:in `next_transaction_id'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:47:in `begin_with_transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:160:in `perform'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:24:in `block in transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `tap'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/logstash-output-stomp-3.0.9/lib/logstash/outputs/stomp.rb:77:in `multi_receive'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:475:in `multi_receive'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:475:in `block in output_batch'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:474:in `each'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:474:in `output_batch'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:426:in `worker_loop'
/CBGM/logstash-6.3.1/logstash-core/lib/logstash/pipeline.rb:384:in `block in start_workers'
Thread.exclusive is deprecated, use Mutex
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp.rb:121:in `next_serial'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:189:in `next_transaction_id'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:47:in `begin_with_transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes/transaction_scope.rb:160:in `perform'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:24:in `block in transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `tap'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/onstomp-1.0.10/lib/onstomp/components/scopes.rb:23:in `transaction'
/CBGM/logstash-6.3.1/vendor/bundle/jruby/2.3.0/gems/logstash-output-stomp-3.0.9/lib/logstash/outputs/stomp.rb:77:in `multi_receive'
Kolano commented 5 years ago

I'm now getting this when starting up Logstash v7.2

Jul  1 23:53:32 pass logstash[12910]: Thread.exclusive is deprecated, use Thread::Mutex
Jul  1 23:53:35 pass logstash[12910]: Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties
Jul  1 23:53:35 pass logstash[12910]: [2019-07-01T23:53:35,645][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.2.0"}
alilland commented 5 years ago

getting the error in v7.3

.\bin\logstash.bat : Thread.exclusive is deprecated, use Thread::Mutex
At line:1 char:1
+ .\bin\logstash.bat
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Thread.exclusiv...e Thread::Mutex:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
kzgrzendek commented 5 years ago

Also have it in 7.4.2 :

Thread.exclusive is deprecated, use Thread::Mutex