logstash-core 7.5.1-java → 7.5.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/java_pipeline.rb +35 -5
- data/lib/logstash/util.rb +4 -14
- data/spec/logstash/util_spec.rb +20 -0
- data/versions-gem-copy.yml +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e5fd3d10f5c62d82169fa91cca236337aacfe3935e631a466dd714f30d6430
|
4
|
+
data.tar.gz: 6c5f1b41c256f31050b8458dd529df41ef6d9f5e4eec2f1fd97608f128e5d839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3800c188c11e0988c3c3e68edee3ff405c0f3f0ceb2d7cbfed8284650d15074ee355eb68f59d390ace8804ded4adc0a0ccd9f7b2966f01c1cdea67243971602
|
7
|
+
data.tar.gz: 107be1d79cb1d8914a48c24bc2f78f69c0839e1eab49b1a8cf1272031d3ea609345a5a58bd2b140494660d2b45006de7b77943fc9b25a55fb390631ef9060864
|
@@ -244,18 +244,28 @@ module LogStash; class JavaPipeline < JavaBasePipeline
|
|
244
244
|
|
245
245
|
filter_queue_client.set_batch_dimensions(batch_size, batch_delay)
|
246
246
|
|
247
|
-
|
247
|
+
# First launch WorkerLoop initialization in separate threads which concurrently
|
248
|
+
# compiles and initializes the worker pipelines
|
249
|
+
|
250
|
+
worker_loops = pipeline_workers.times
|
251
|
+
.map { Thread.new { init_worker_loop } }
|
252
|
+
.map(&:value)
|
253
|
+
|
254
|
+
fail("Some worker(s) were not correctly initialized") if worker_loops.any?{|v| v.nil?}
|
255
|
+
|
256
|
+
# Once all WorkerLoop have been initialized run them in separate threads
|
257
|
+
|
258
|
+
worker_loops.each_with_index do |worker_loop, t|
|
248
259
|
thread = Thread.new do
|
249
260
|
Util.set_thread_name("[#{pipeline_id}]>worker#{t}")
|
250
261
|
ThreadContext.put("pipeline.id", pipeline_id)
|
251
|
-
|
252
|
-
lir_execution, filter_queue_client, @events_filtered, @events_consumed,
|
253
|
-
@flushRequested, @flushing, @shutdownRequested, @drain_queue).run
|
262
|
+
worker_loop.run
|
254
263
|
end
|
255
264
|
@worker_threads << thread
|
256
265
|
end
|
257
266
|
|
258
|
-
# inputs should be started last, after all workers
|
267
|
+
# Finally inputs should be started last, after all workers have been initialized and started
|
268
|
+
|
259
269
|
begin
|
260
270
|
start_inputs
|
261
271
|
rescue => e
|
@@ -470,6 +480,26 @@ module LogStash; class JavaPipeline < JavaBasePipeline
|
|
470
480
|
|
471
481
|
private
|
472
482
|
|
483
|
+
# @return [WorkerLoop] a new WorkerLoop instance or nil upon construction exception
|
484
|
+
def init_worker_loop
|
485
|
+
begin
|
486
|
+
org.logstash.execution.WorkerLoop.new(
|
487
|
+
lir_execution,
|
488
|
+
filter_queue_client,
|
489
|
+
@events_filtered,
|
490
|
+
@events_consumed,
|
491
|
+
@flushRequested,
|
492
|
+
@flushing,
|
493
|
+
@shutdownRequested,
|
494
|
+
@drain_queue)
|
495
|
+
rescue => e
|
496
|
+
@logger.error(
|
497
|
+
"Worker loop initialization error",
|
498
|
+
default_logging_keys(:error => e.message, :exception => e.class, :stacktrace => e.backtrace.join("\n")))
|
499
|
+
nil
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
473
503
|
def maybe_setup_out_plugins
|
474
504
|
if @outputs_registered.make_true
|
475
505
|
register_plugins(outputs)
|
data/lib/logstash/util.rb
CHANGED
@@ -11,10 +11,8 @@ module LogStash::Util
|
|
11
11
|
def self.set_thread_name(name)
|
12
12
|
previous_name = Java::java.lang.Thread.currentThread.getName() if block_given?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
Java::java.lang.Thread.currentThread.setName(name)
|
17
|
-
end
|
14
|
+
# Keep java and ruby thread names in sync.
|
15
|
+
Java::java.lang.Thread.currentThread.setName(name)
|
18
16
|
Thread.current[:name] = name
|
19
17
|
|
20
18
|
if UNAME == "linux"
|
@@ -37,18 +35,10 @@ module LogStash::Util
|
|
37
35
|
Thread.current[:plugin] = plugin
|
38
36
|
end
|
39
37
|
|
40
|
-
def self.get_thread_id(thread)
|
41
|
-
if RUBY_ENGINE == "jruby"
|
42
|
-
JRuby.reference(thread).native_thread.id
|
43
|
-
else
|
44
|
-
raise Exception.new("Native thread IDs aren't supported outside of JRuby")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
38
|
def self.thread_info(thread)
|
49
39
|
# When the `thread` is dead, `Thread#backtrace` returns `nil`; fall back to an empty array.
|
50
40
|
backtrace = (thread.backtrace || []).map do |line|
|
51
|
-
line.
|
41
|
+
line.sub(LogStash::Environment::LOGSTASH_HOME, "[...]")
|
52
42
|
end
|
53
43
|
|
54
44
|
blocked_on = case backtrace.first
|
@@ -58,7 +48,7 @@ module LogStash::Util
|
|
58
48
|
end
|
59
49
|
|
60
50
|
{
|
61
|
-
"thread_id" => get_thread_id(thread),
|
51
|
+
"thread_id" => get_thread_id(thread), # might be nil for dead threads
|
62
52
|
"name" => thread[:name],
|
63
53
|
"plugin" => (thread[:plugin] ? thread[:plugin].debug_info : nil),
|
64
54
|
"backtrace" => backtrace,
|
data/spec/logstash/util_spec.rb
CHANGED
@@ -67,4 +67,24 @@ describe LogStash::Util do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
describe ".get_thread_id" do
|
72
|
+
it "returns native identifier" do
|
73
|
+
thread_id = LogStash::Util.get_thread_id(Thread.current)
|
74
|
+
expect( thread_id ).to be_a Integer
|
75
|
+
expect( thread_id ).to eq(java.lang.Thread.currentThread.getId)
|
76
|
+
end
|
77
|
+
|
78
|
+
context "when a (native) thread is collected" do
|
79
|
+
let(:dead_thread) { Thread.new { 42 }.tap { |t| sleep(0.01) while t.status } }
|
80
|
+
|
81
|
+
it "returns nil as id" do
|
82
|
+
thread = dead_thread
|
83
|
+
p thread if $VERBOSE
|
84
|
+
2.times { java.lang.System.gc || sleep(0.01) } # we're assuming a full-gc to clear all weak-refs
|
85
|
+
# NOTE: if you notice this spec failing - remote it (a java.lang.Thread weak-ref might stick around)
|
86
|
+
expect(LogStash::Util.get_thread_id(thread)).to be nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
70
90
|
end
|
data/versions-gem-copy.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
# alpha and beta qualifiers are now added via VERSION_QUALIFIER environment var
|
3
|
-
logstash: 7.5.
|
4
|
-
logstash-core: 7.5.
|
3
|
+
logstash: 7.5.2
|
4
|
+
logstash-core: 7.5.2
|
5
5
|
logstash-core-plugin-api: 2.1.16
|
6
6
|
|
7
7
|
# jruby must reference a *released* version of jruby which can be downloaded from the official download url
|
@@ -21,8 +21,8 @@ jruby:
|
|
21
21
|
# Note: this file is copied to the root of logstash-core because its gemspec needs it when
|
22
22
|
# bundler evaluates the gemspec via bin/logstash
|
23
23
|
# Ensure Jackson version here is kept in sync with version used by jrjackson gem
|
24
|
-
jrjackson: 0.4.
|
25
|
-
jackson: 2.9.
|
26
|
-
jackson-databind: 2.9.
|
24
|
+
jrjackson: 0.4.11
|
25
|
+
jackson: 2.9.10
|
26
|
+
jackson-databind: 2.9.10.1
|
27
27
|
|
28
28
|
# This is a copy the project level versions.yml into this gem's root and it is created when the gemspec is evaluated.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.5.
|
4
|
+
version: 7.5.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,7 +251,7 @@ dependencies:
|
|
251
251
|
requirements:
|
252
252
|
- - '='
|
253
253
|
- !ruby/object:Gem::Version
|
254
|
-
version: 0.4.
|
254
|
+
version: 0.4.11
|
255
255
|
name: jrjackson
|
256
256
|
prerelease: false
|
257
257
|
type: :runtime
|
@@ -259,7 +259,7 @@ dependencies:
|
|
259
259
|
requirements:
|
260
260
|
- - '='
|
261
261
|
- !ruby/object:Gem::Version
|
262
|
-
version: 0.4.
|
262
|
+
version: 0.4.11
|
263
263
|
- !ruby/object:Gem::Dependency
|
264
264
|
requirement: !ruby/object:Gem::Requirement
|
265
265
|
requirements:
|