logstash-input-tcp 5.0.1-java → 5.0.2-java

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: 742ec0ab317795f68e1bc001b74c7c893bfb61de
4
- data.tar.gz: bff14817270bc44427e8dedc7eeccb55c8510565
3
+ metadata.gz: 194c2ce3a58504f3d3290cc5adc7945faffd3ff6
4
+ data.tar.gz: 46faee2a86e761688e5168709c986b3f295af60c
5
5
  SHA512:
6
- metadata.gz: 7fe956bd95212a4530fb8a22fd328b4cb66f576e551127ffda60033f1a0539ae2751bc4d3c6b2038cc6e260b2d5e8118033963a133c7f9cd13e9740e24863321
7
- data.tar.gz: d95be2441f2be3cfc063801ef10647fbd571b44c01b491c138fbc377f344e87b9efadb0d0f2e41fb496b3a52ba165478a56c0f7d7d0e6336049956977ea0bf0b
6
+ metadata.gz: bc017846852684f7cc36c933a5d4e58b9155a778a7d23589d06e6c44f08e6eafe1c7f80b70f750188a85633b69dfbbd3b11024e26c7b6b535dab24f5c51f6ee2
7
+ data.tar.gz: f90e391609b3f666aeba6f5ba9e283239b147728d3d15674cf31bb543a240260b47337cbca9aa46012d610fee6f975eb8f4ef505ceb0be2a5f7c704059b34c2d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 5.0.2
2
+ - Fix bug where this input would crash logstash during some socket reads when acting as an SSL server
3
+
1
4
  ## 5.0.1
2
5
  - Fix some documentation issues
3
6
 
@@ -189,6 +189,7 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
189
189
 
190
190
  private
191
191
 
192
+ RUN_LOOP_ERROR_MESSAGE="TCP input server encountered error"
192
193
  def run_ssl_server()
193
194
  while !stop?
194
195
  begin
@@ -199,9 +200,12 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
199
200
  # log error, close socket, accept next connection
200
201
  @logger.debug? && @logger.debug("SSL Error", :exception => e, :backtrace => e.backtrace)
201
202
  rescue => e
202
- # if this exception occured while the plugin is stopping
203
- # just ignore and exit
204
- raise e unless stop?
203
+ @logger.error(
204
+ RUN_LOOP_ERROR_MESSAGE,
205
+ :message => e.message,
206
+ :class => e.class.name,
207
+ :backtrace => e.backtrace
208
+ )
205
209
  end
206
210
  end
207
211
  ensure
@@ -15,6 +15,20 @@ require_relative "../spec_helper"
15
15
  #Cabin::Channel.get(LogStash).level = :debug
16
16
  describe LogStash::Inputs::Tcp do
17
17
 
18
+ def get_port
19
+ begin
20
+ # Start high to better avoid common services
21
+ port = rand(10000..65535)
22
+ s = TCPServer.new("127.0.0.1", port)
23
+ s.close
24
+ return port
25
+ rescue Errno::EADDRINUSE
26
+ retry
27
+ end
28
+ end
29
+
30
+ let(:port) { get_port }
31
+
18
32
  context "codec (PR #1372)" do
19
33
  it "switches from plain to line" do
20
34
  require "logstash/codecs/plain"
@@ -36,7 +50,6 @@ describe LogStash::Inputs::Tcp do
36
50
 
37
51
  it "should read plain with unicode" do
38
52
  event_count = 10
39
- port = rand(1024..65535)
40
53
  conf = <<-CONFIG
41
54
  input {
42
55
  tcp {
@@ -69,12 +82,11 @@ describe LogStash::Inputs::Tcp do
69
82
 
70
83
  it "should handle PROXY protocol v1 connections" do
71
84
  event_count = 10
72
- port = rand(1024..65535)
73
85
  conf = <<-CONFIG
74
86
  input {
75
87
  tcp {
76
- port => #{port}
77
88
  proxy_protocol => true
89
+ port => '#{port}'
78
90
  }
79
91
  }
80
92
  CONFIG
@@ -104,7 +116,6 @@ describe LogStash::Inputs::Tcp do
104
116
  end
105
117
 
106
118
  it "should read events with plain codec and ISO-8859-1 charset" do
107
- port = rand(1024..65535)
108
119
  charset = "ISO-8859-1"
109
120
  conf = <<-CONFIG
110
121
  input {
@@ -132,7 +143,6 @@ describe LogStash::Inputs::Tcp do
132
143
  end
133
144
 
134
145
  it "should read events with json codec" do
135
- port = rand(1024..65535)
136
146
  conf = <<-CONFIG
137
147
  input {
138
148
  tcp {
@@ -167,7 +177,6 @@ describe LogStash::Inputs::Tcp do
167
177
  end
168
178
 
169
179
  it "should read events with json codec (testing 'host' handling)" do
170
- port = rand(1024..65535)
171
180
  conf = <<-CONFIG
172
181
  input {
173
182
  tcp {
@@ -194,7 +203,6 @@ describe LogStash::Inputs::Tcp do
194
203
  end
195
204
 
196
205
  it "should read events with json_lines codec" do
197
- port = rand(1024..65535)
198
206
  conf = <<-CONFIG
199
207
  input {
200
208
  tcp {
@@ -233,7 +241,6 @@ describe LogStash::Inputs::Tcp do
233
241
 
234
242
  it "should one message per connection" do
235
243
  event_count = 10
236
- port = rand(1024..65535)
237
244
  conf = <<-CONFIG
238
245
  input {
239
246
  tcp {
@@ -271,7 +278,6 @@ describe LogStash::Inputs::Tcp do
271
278
  srand(RSpec.configuration.seed)
272
279
  end
273
280
 
274
- let(:port) { rand(1024..65535) }
275
281
  subject { LogStash::Plugin.lookup("input", "tcp").new({ "port" => port }) }
276
282
  let!(:helper) { TcpHelpers.new }
277
283
 
@@ -348,6 +354,41 @@ describe LogStash::Inputs::Tcp do
348
354
  end
349
355
  end
350
356
 
357
+ describe "an error occurs during an accept" do
358
+ let(:socket) { double("socket").as_null_object }
359
+
360
+ before do
361
+ allow(input).to receive(:server_socket).and_return(socket)
362
+
363
+ allow(socket).to receive(:accept) do |a1, a2, a3|
364
+ raise StandardError, "blah"
365
+ end
366
+ end
367
+
368
+ it "should log the error on accept" do
369
+ allow(input.logger).to receive(:error).with(any_args)
370
+
371
+ stop = Thread.new {
372
+ sleep 2
373
+ input.do_stop
374
+ }
375
+ expect do
376
+ input.run(Queue.new)
377
+ end.not_to raise_error
378
+
379
+ expect(input.logger).to have_received(:error).with(
380
+ ::LogStash::Inputs::Tcp::RUN_LOOP_ERROR_MESSAGE,
381
+ :message => "blah",
382
+ :class => "StandardError",
383
+ :backtrace => anything
384
+ ).at_least(:once)
385
+
386
+ stop.join
387
+ # Wait for stop to actually happen
388
+ sleep 1
389
+ end
390
+ end
391
+
351
392
  context "that sends garbage instead of TLS handshake" do
352
393
  let!(:input_task) { Stud::Task.new { input.run(queue) } }
353
394
  let(:max_length) { 1000 }
data/version CHANGED
@@ -1 +1 @@
1
- 5.0.1
1
+ 5.0.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-tcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-16 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -147,7 +147,7 @@ files:
147
147
  - logstash-input-tcp.gemspec
148
148
  - spec/inputs/tcp_spec.rb
149
149
  - spec/spec_helper.rb
150
- - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/5.0.1/logstash-input-tcp-5.0.1.jar
150
+ - vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/5.0.2/logstash-input-tcp-5.0.2.jar
151
151
  - version
152
152
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
153
153
  licenses: