Skip to content

Mark both client and server as not worker safe #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ rvm:
script:
- bundle exec rspec spec
jdk: oraclejdk8
before_install: []
script: bundle exec rspec spec && bundle exec rspec spec --tag integration
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.2.0
- Declare plugin as not worker safe for both server and client mode. (IO#select is not threadsafe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think server mode is worker safe. Can you add a comment in the code linking to where IO#select is noted as not threadsafe in JRuby (docs somewhere on jruby, if possible?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server mode was already marked as workers_not_supported before my change. Is this not the case? It shouldn't be, AFAICT given that only one worker can bind to a port.


## 3.1.0
- breaking,config: Remove deprecated config `message_format`

Expand All @@ -14,7 +17,6 @@
- New dependency requirements for logstash-core for the 5.0 release

## 2.0.0
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
- Dependency on logstash-core update to 2.0

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ Programming is not a required skill. Whatever you've seen about open source and

It is more important to the community that you are able to contribute.

For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
7 changes: 5 additions & 2 deletions lib/logstash/outputs/tcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class LogStash::Outputs::Tcp < LogStash::Outputs::Base
# `client` connects to a server.
config :mode, :validate => ["server", "client"], :default => "client"

declare_workers_not_supported!

class Client
public
def initialize(socket, logger)
Expand Down Expand Up @@ -61,9 +63,10 @@ def write(msg)
def register
require "socket"
require "stud/try"
if server?
workers_not_supported

workers_not_supported

if server?
@logger.info("Starting tcp output listener", :address => "#{@host}:#{@port}")
@server_socket = TCPServer.new(@host, @port)
@client_threads = []
Expand Down
3 changes: 1 addition & 2 deletions logstash-output-tcp.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

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

s.add_development_dependency 'logstash-devutils'
end