Skip to content
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

add thread safety around the BufferedTokenizer usage #13

Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+9 −5
Diff settings


Just for now

@@ -1,3 +1,6 @@
## 3.0.6

This comment has been minimized.

Copy link

jakelandis Dec 12, 2017



- Fixed thread safety issue. See

## 3.0.5
- Update gemspec summary

@@ -1,6 +1,7 @@
# encoding: utf-8
require "logstash/codecs/base"
require "logstash/util/charset"
require "thread"

# Line-oriented text data.
@@ -31,18 +32,18 @@ def register
@buffer =
@converter =
@converter.logger = @logger
@buffer_mutex =

def decode(data)
@buffer.extract(data).each do |line|
yield"message" => @converter.convert(line))
lines = @buffer_mutex.synchronize { @buffer.extract(data) }
lines.each { |line| yield"message" => @converter.convert(line)) }
end # def decode

def flush(&block)
remainder = @buffer.flush
remainder = @buffer_mutex.synchronize { @buffer.flush }
if !remainder.empty?"message" => @converter.convert(remainder)))
@@ -1,7 +1,7 @@ do |s| = 'logstash-codec-line'
s.version = '3.0.5'
s.version = '3.0.6'
s.licenses = ['Apache License (2.0)']
s.summary = "Reads line-oriented text data"
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"
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.