logstash-codec-multiline 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb29402e4fc64969af12f38713f553e18dc57418
4
- data.tar.gz: f8a9fb89870cc25e7a252b11c47e7c5e5dc94eb7
3
+ metadata.gz: 36df6112f2d0e3f3d6b3d0481a72e5250fae5352
4
+ data.tar.gz: b86e58bbb8f62680e7ab478adc0d75a3d61d6530
5
5
  SHA512:
6
- metadata.gz: 89e537074ac1b46b495e0ae0a926abed3a9609ef906f519e70b3b68753b4ecdebb6e4ef04cd8d926a535fc65ac2335677b85cba500d5061dbbe9e8c68364aaca
7
- data.tar.gz: 76e16b208297f0bbeb47bb8f00daabd8b89017d7a4181478e06e72b19bfa73c99e7065ad6cc9e229786d772298c7eb0eea936f68f953aa3cbdb62ce42f12a690
6
+ metadata.gz: afe492266d2d77c9946ff76ad71e755f8d03a655222f92673f70d0804b99543edd82dbb3365674f1f640036eb24cb42c6f3b65d6bea290378e959de6f6356bfe
7
+ data.tar.gz: e053998e3802437a06a82b5997f28c8bc4983b80c936a1d9bbbe3b81a4a99be11f6086dac0f01a73c69fb2770728ee6ef030f807714c226a7e570815d11c49d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.0.7
2
+ - Fix for issue #23, Thread deadlock on auto-flush when using multiple inputs with this codec. Use cancel + execute on ScheduledTask instead of reset.
3
+
1
4
  ## 2.0.6
2
5
  - Isolate spec helper classes in their own namespace.
3
6
 
data/Gemfile CHANGED
@@ -1,2 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+ gemspec
3
+ gem "concurrent-ruby", "0.9.1"
@@ -7,20 +7,48 @@ module LogStash module Codecs class AutoFlush
7
7
  @stopped = Concurrent::AtomicBoolean.new # false by default
8
8
  end
9
9
 
10
+ # def start
11
+ # # can't start if pipeline is stopping
12
+ # return self if stopped?
13
+ # if pending?
14
+ # @task.cancel
15
+ # create_task
16
+ # elsif finished?
17
+ # create_task
18
+ # # else the task is executing
19
+ # end
20
+ # self
21
+ # end
22
+
10
23
  def start
11
24
  # can't start if pipeline is stopping
12
25
  return self if stopped?
13
- if pending?
14
- @task.reset
15
- elsif finished?
16
- @task = Concurrent::ScheduledTask.execute(@interval) do
17
- @mc.auto_flush()
18
- end
19
- # else the task is executing
26
+
27
+ if pending? && @task.cancel
28
+ create_task
29
+ return self
30
+ end
31
+ # maybe we have a timing edge case
32
+ # where pending? was true but cancel failed
33
+ # because the task started running
34
+ if finished?
35
+ create_task
36
+ return self
20
37
  end
38
+ # else the task is executing
39
+ # wait for task to complete
40
+ # flush could feasibly block on queue access
41
+ @task.value
42
+ create_task
21
43
  self
22
44
  end
23
45
 
46
+ def create_task
47
+ @task = Concurrent::ScheduledTask.execute(@interval) do
48
+ @mc.auto_flush()
49
+ end
50
+ end
51
+
24
52
  def finished?
25
53
  return true if @task.nil?
26
54
  @task.fulfilled?
@@ -36,6 +64,10 @@ module LogStash module Codecs class AutoFlush
36
64
 
37
65
  def stop
38
66
  @stopped.make_true
67
+ cancel
68
+ end
69
+
70
+ def cancel
39
71
  @task.cancel if pending?
40
72
  end
41
73
  end
@@ -63,4 +95,8 @@ class AutoFlushUnset
63
95
  def stop
64
96
  self
65
97
  end
98
+
99
+ def cancel
100
+ self
101
+ end
66
102
  end end end
@@ -129,7 +129,7 @@ module LogStash module Codecs class Multiline < LogStash::Codecs::Base
129
129
 
130
130
  # The accumulation of multiple lines will be converted to an event when either a
131
131
  # matching new line is seen or there has been no new data appended for this time
132
- # auto_flush_interval. No default. If unset, no auto_flush
132
+ # auto_flush_interval. No default. If unset, no auto_flush. Units: seconds
133
133
  config :auto_flush_interval, :validate => :number
134
134
 
135
135
  public
@@ -195,10 +195,7 @@ module LogStash module Codecs class Multiline < LogStash::Codecs::Base
195
195
 
196
196
  def buffer(text)
197
197
  @buffer_bytes += text.bytesize
198
- @buffer.push(text).tap do |b|
199
- # do start but preserve the return value
200
- auto_flush_runner.start
201
- end
198
+ @buffer.push(text)
202
199
  end
203
200
 
204
201
  def flush(&block)
@@ -247,11 +244,13 @@ module LogStash module Codecs class Multiline < LogStash::Codecs::Base
247
244
 
248
245
  def do_next(text, matched, &block)
249
246
  buffer(text)
247
+ auto_flush_runner.start
250
248
  flush(&block) if !matched || buffer_over_limits?
251
249
  end
252
250
 
253
251
  def do_previous(text, matched, &block)
254
252
  flush(&block) if !matched || buffer_over_limits?
253
+ auto_flush_runner.start
255
254
  buffer(text)
256
255
  end
257
256
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-multiline'
4
- s.version = '2.0.6'
4
+ s.version = '2.0.7'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "The multiline codec will collapse multiline messages and merge them into a single event."
7
7
  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"
metadata CHANGED
@@ -1,77 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-multiline
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-31 00:00:00.000000000 Z
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logstash-core
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 2.0.0
20
- - - <
21
- - !ruby/object:Gem::Version
22
- version: 3.0.0
23
14
  requirement: !ruby/object:Gem::Requirement
24
15
  requirements:
25
- - - '>='
16
+ - - ">="
26
17
  - !ruby/object:Gem::Version
27
18
  version: 2.0.0
28
- - - <
19
+ - - "<"
29
20
  - !ruby/object:Gem::Version
30
21
  version: 3.0.0
22
+ name: logstash-core
31
23
  prerelease: false
32
24
  type: :runtime
33
- - !ruby/object:Gem::Dependency
34
- name: logstash-patterns-core
35
25
  version_requirements: !ruby/object:Gem::Requirement
36
26
  requirements:
37
- - - '>='
27
+ - - ">="
38
28
  - !ruby/object:Gem::Version
39
- version: '0'
29
+ version: 2.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
40
34
  requirement: !ruby/object:Gem::Requirement
41
35
  requirements:
42
- - - '>='
36
+ - - ">="
43
37
  - !ruby/object:Gem::Version
44
38
  version: '0'
39
+ name: logstash-patterns-core
45
40
  prerelease: false
46
41
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: jls-grok
49
42
  version_requirements: !ruby/object:Gem::Requirement
50
43
  requirements:
51
- - - ~>
44
+ - - ">="
52
45
  - !ruby/object:Gem::Version
53
- version: 0.11.1
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
54
48
  requirement: !ruby/object:Gem::Requirement
55
49
  requirements:
56
- - - ~>
50
+ - - "~>"
57
51
  - !ruby/object:Gem::Version
58
52
  version: 0.11.1
53
+ name: jls-grok
59
54
  prerelease: false
60
55
  type: :runtime
61
- - !ruby/object:Gem::Dependency
62
- name: logstash-devutils
63
56
  version_requirements: !ruby/object:Gem::Requirement
64
57
  requirements:
65
- - - '>='
58
+ - - "~>"
66
59
  - !ruby/object:Gem::Version
67
- version: '0'
60
+ version: 0.11.1
61
+ - !ruby/object:Gem::Dependency
68
62
  requirement: !ruby/object:Gem::Requirement
69
63
  requirements:
70
- - - '>='
64
+ - - ">="
71
65
  - !ruby/object:Gem::Version
72
66
  version: '0'
67
+ name: logstash-devutils
73
68
  prerelease: false
74
69
  type: :development
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
75
  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
76
76
  email: info@elastic.co
77
77
  executables: []
@@ -104,12 +104,12 @@ require_paths:
104
104
  - lib
105
105
  required_ruby_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - '>='
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []