Skip to content

Commit ec831a7

Browse files
committed
Mark both client and server as not worker safe
This is due to IO#select not being threadsafe in JRuby Fixes #13
1 parent d582daa commit ec831a7

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
## 2.0.3
2+
- Declare plugin as not worker safe for both server and client mode. (IO#select is not threadsafe)
13
## 2.0.0
2-
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
4+
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
35
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
46
- Dependency on logstash-core update to 2.0
5-

lib/logstash/outputs/tcp.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class LogStash::Outputs::Tcp < LogStash::Outputs::Base
3838
# event will be written as a single line.
3939
config :message_format, :validate => :string, :deprecated => true
4040

41+
# respond_to? check needed for backwards compatibility with < 2.2 Logstashes
42+
declare_workers_not_supported! if self.respond_to?(:workers_not_supported!)
43+
4144
class Client
4245
public
4346
def initialize(socket, logger)
@@ -69,9 +72,10 @@ def write(msg)
6972
def register
7073
require "socket"
7174
require "stud/try"
72-
if server?
73-
workers_not_supported
7475

76+
workers_not_supported
77+
78+
if server?
7579
@logger.info("Starting tcp output listener", :address => "#{@host}:#{@port}")
7680
@server_socket = TCPServer.new(@host, @port)
7781
@client_threads = []

logstash-output-tcp.gemspec

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-output-tcp'
4-
s.version = '2.0.2'
4+
s.version = '2.0.3'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Write events over a TCP socket."
77
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -27,4 +27,3 @@ Gem::Specification.new do |s|
2727

2828
s.add_development_dependency 'logstash-devutils'
2929
end
30-

0 commit comments

Comments
 (0)