From 1df893b5db924cbfa987fe44e1719979e70125da Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Fri, 9 Aug 2019 19:47:17 +0100 Subject: [PATCH 1/8] Support nested C# exceptions * Inner exceptions * Aggregate exceptions (from wait operations on failed tasks) * Exceptions thrown from asynchronous code --- lib/fluent/plugin/exception_detector.rb | 16 ++++++++ test/plugin/test_exception_detector.rb | 50 +++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 60a23b3..df10ee1 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -59,6 +59,22 @@ def self.supported :java_start_exception), rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), + + # C# nested exception + rule([:java_after_exception, :java], + /^[\t ]+--- End of inner exception stack trace ---/, + :java), + + # C# aggregate exception + rule([:java_after_exception, :java], + /^---> \(Inner Exception #[0-9]+\)/, + :java), + + # C# exception from async code + rule([:java_after_exception, :java], + /^--- End of stack trace from previous location where exception was thrown ---/, + :java), + rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, :java_after_exception), rule([:java_after_exception, :java], diff --git a/test/plugin/test_exception_detector.rb b/test/plugin/test_exception_detector.rb index 983f696..17a5516 100644 --- a/test/plugin/test_exception_detector.rb +++ b/test/plugin/test_exception_detector.rb @@ -256,6 +256,50 @@ class ExceptionDetectorTest < Test::Unit::TestCase at System.Threading.Thread.StartInternal () [0x00000] in :0 END + CSHARP_NESTED_EXC = < System.InvalidOperationException: This is the inner exception + at ExampleApp.NestedExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 33 + at ExampleApp.NestedExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 28 + at ExampleApp.NestedExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 18 + --- End of inner exception stack trace --- + at ExampleApp.NestedExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 22 + at ExampleApp.NestedExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/NestedExceptionExample.cs:line 11 + at ExampleApp.Program.Main(String[] args) in c:/ExampleApp/ExampleApp/Program.cs:line 11 +END + + CSHARP_AGGREGATE_EXC = < System.InvalidOperationException: This is an exception + at ExampleApp.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 28 + at ExampleApp.AsyncExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 23 + at ExampleApp.AsyncExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 17 + at ExampleApp.AsyncExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 12 + --- End of inner exception stack trace --- + at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) + at System.Threading.Tasks.Task.Wait() + at ExampleApp.Program.Main(String[] args) in c:/ExampleApp/ExampleApp/Program.cs:line 12 +---> (Inner Exception #0) System.InvalidOperationException: This is an exception + at ExampleApp.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 28 + at ExampleApp.AsyncExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 23 + at ExampleApp.AsyncExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 17 + at ExampleApp.AsyncExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 12<--- +END + + CSHARP_ASYNC_EXC = <d__2.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 31 +--- End of stack trace from previous location where exception was thrown --- + at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + at ExampleApp2.AsyncExceptionExample.d__1.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 25 +--- End of stack trace from previous location where exception was thrown --- + at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + at ExampleApp2.AsyncExceptionExample.d__0.MoveNext() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 14 +END + RUBY_EXC = <): app/controllers/books_controller.rb:69:in `recursivewordload' @@ -570,6 +614,9 @@ def test_js def test_csharp check_exception(CSHARP_EXC, false) + check_exception(CSHARP_NESTED_EXC, false) + check_exception(CSHARP_AGGREGATE_EXC, false) + check_exception(CSHARP_ASYNC_EXC, false) end def test_python @@ -627,6 +674,9 @@ def test_mixed_languages check_exception(GO_ON_GAE_EXC, false) check_exception(GO_SIGNAL_EXC, false) check_exception(CSHARP_EXC, false) + check_exception(CSHARP_NESTED_EXC, false) + check_exception(CSHARP_AGGREGATE_EXC, false) + check_exception(CSHARP_ASYNC_EXC, false) check_exception(V8_JS_EXC, false) check_exception(RUBY_EXC, false) check_exception(DART_ERR, false) From 980d6a2dbed4722ad3b3b79a05f18204e297096a Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Sat, 10 Aug 2019 17:24:54 +0100 Subject: [PATCH 2/8] Linting changes * Aligning method params properly * Attempting to put long regex on multi-lines --- lib/fluent/plugin/exception_detector.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index df10ee1..662504d 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -62,18 +62,19 @@ def self.supported # C# nested exception rule([:java_after_exception, :java], - /^[\t ]+--- End of inner exception stack trace ---/, - :java), + /^[\t ]+--- End of inner exception stack trace ---/, + :java), # C# aggregate exception rule([:java_after_exception, :java], - /^---> \(Inner Exception #[0-9]+\)/, - :java), + /^---> \(Inner Exception #[0-9]+\)/, + :java), # C# exception from async code rule([:java_after_exception, :java], - /^--- End of stack trace from previous location where exception was thrown ---/, - :java), + %r{^---\sEnd\sof\sstack\strace\sfrom\sprevious\s + location\swhere\sexception\swas\sthrown\s---}x, + :java), rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, :java_after_exception), From fc9cdd7a5b300d6a54fc5baa7f97afe323036bc8 Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Sat, 10 Aug 2019 17:30:13 +0100 Subject: [PATCH 3/8] Linting changes * Don't use %r{} around regex --- lib/fluent/plugin/exception_detector.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 662504d..b734fb5 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -72,8 +72,8 @@ def self.supported # C# exception from async code rule([:java_after_exception, :java], - %r{^---\sEnd\sof\sstack\strace\sfrom\sprevious\s - location\swhere\sexception\swas\sthrown\s---}x, + /^---\sEnd\sof\sstack\strace\sfrom\sprevious\s + location\swhere\sexception\swas\sthrown\s---/x, :java), rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, From a991faaa09c74bb19a40bb6cb9a377bc021441ea Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Mon, 12 Aug 2019 07:52:48 +0100 Subject: [PATCH 4/8] Create distinct rules/states for C# exceptions Updated the state machine to allow multiple current states, to cope with the case where it is ambiguous if the start of an exception is Java or C# --- lib/fluent/plugin/exception_detector.rb | 68 +++++++++++++++++-------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index b734fb5..1461414 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -59,27 +59,34 @@ def self.supported :java_start_exception), rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), + rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, + :java_after_exception), + rule([:java_after_exception, :java], + /^[\t ]*... \d+ (?:more|common frames omitted)/, :java) + ].freeze + + CSHARP_RULES = [ + rule([:start_state, :csharp_start_exception], + /(?:Exception)[:\r\n]/, + :csharp_after_exception), + rule(:csharp_after_exception, /^[\r\n]*$/, :csharp_after_exception), + rule([:csharp_after_exception, :csharp], /^[\t ]+at /, :csharp), # C# nested exception - rule([:java_after_exception, :java], + rule([:csharp], /^[\t ]+--- End of inner exception stack trace ---/, - :java), + :csharp_after_exception), # C# aggregate exception - rule([:java_after_exception, :java], + rule([:csharp], /^---> \(Inner Exception #[0-9]+\)/, - :java), + :csharp_after_exception), # C# exception from async code - rule([:java_after_exception, :java], + rule([:csharp], /^---\sEnd\sof\sstack\strace\sfrom\sprevious\s location\swhere\sexception\swas\sthrown\s---/x, - :java), - - rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, - :java_after_exception), - rule([:java_after_exception, :java], - /^[\t ]*... \d+ (?:more|common frames omitted)/, :java) + :csharp_after_exception) ].freeze PYTHON_RULES = [ @@ -153,14 +160,15 @@ def self.supported ].freeze ALL_RULES = ( - JAVA_RULES + PYTHON_RULES + PHP_RULES + GO_RULES + RUBY_RULES + DART_RULES + JAVA_RULES + CSHARP_RULES + PYTHON_RULES + PHP_RULES + + GO_RULES + RUBY_RULES + DART_RULES ).freeze RULES_BY_LANG = { java: JAVA_RULES, javascript: JAVA_RULES, js: JAVA_RULES, - csharp: JAVA_RULES, + csharp: CSHARP_RULES, py: PYTHON_RULES, python: PYTHON_RULES, php: PHP_RULES, @@ -178,7 +186,7 @@ def self.supported # multi-line stack traces. class ExceptionDetector def initialize(*languages) - @state = :start_state + reset @rules = Hash.new { |h, k| h[k] = [] } languages = [:all] if languages.empty? @@ -212,8 +220,8 @@ def update(line) # defined transition for 'line', trigger another state transition because # 'line' may contain the beginning of another exception. transition(line) unless trace_seen_before - new_state = @state - trace_seen_after = new_state != :start_state + new_states = @states + trace_seen_after = new_states != Set[:start_state] case [trace_seen_before, trace_seen_after] when [true, true] @@ -228,7 +236,7 @@ def update(line) end def reset - @state = :start_state + @states = Set[:start_state] end private @@ -236,14 +244,30 @@ def reset # Executes a transition of the state machine for the given line. # Returns false if the line does not match any transition rule and the # state machine was reset to the initial state. + # + # The state machine may be in multiple distinct states at once to cope + # with the situation where the applicable rules aren't distinct enough + # to unambiguously determine a single state. The will occur, for example, + # for the start of a Java or C# exception, where the rules to transition + # to both the :java_start_exception and :csharp_start_exception would + # match. def transition(line) - @rules[@state].each do |r| - next unless line =~ r.pattern - @state = r.to_state + new_states = Set.new + @states.each do |s| + @rules[s].each do |r| + next unless line =~ r.pattern + new_states << r.to_state + break unless s == :start_state + end + end + + if new_states.empty? + reset + return false + else + @states = new_states return true end - @state = :start_state - false end end From 7fa27c0d842d804a7fd81724a2916389fcaacca5 Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Tue, 13 Aug 2019 07:30:00 +0100 Subject: [PATCH 5/8] Reverting separate rule list for C# This was causing too much of a slowdown --- lib/fluent/plugin/exception_detector.rb | 68 ++++++++----------------- 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 1461414..b734fb5 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -59,34 +59,27 @@ def self.supported :java_start_exception), rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), - rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, - :java_after_exception), - rule([:java_after_exception, :java], - /^[\t ]*... \d+ (?:more|common frames omitted)/, :java) - ].freeze - - CSHARP_RULES = [ - rule([:start_state, :csharp_start_exception], - /(?:Exception)[:\r\n]/, - :csharp_after_exception), - rule(:csharp_after_exception, /^[\r\n]*$/, :csharp_after_exception), - rule([:csharp_after_exception, :csharp], /^[\t ]+at /, :csharp), # C# nested exception - rule([:csharp], + rule([:java_after_exception, :java], /^[\t ]+--- End of inner exception stack trace ---/, - :csharp_after_exception), + :java), # C# aggregate exception - rule([:csharp], + rule([:java_after_exception, :java], /^---> \(Inner Exception #[0-9]+\)/, - :csharp_after_exception), + :java), # C# exception from async code - rule([:csharp], + rule([:java_after_exception, :java], /^---\sEnd\sof\sstack\strace\sfrom\sprevious\s location\swhere\sexception\swas\sthrown\s---/x, - :csharp_after_exception) + :java), + + rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/, + :java_after_exception), + rule([:java_after_exception, :java], + /^[\t ]*... \d+ (?:more|common frames omitted)/, :java) ].freeze PYTHON_RULES = [ @@ -160,15 +153,14 @@ def self.supported ].freeze ALL_RULES = ( - JAVA_RULES + CSHARP_RULES + PYTHON_RULES + PHP_RULES + - GO_RULES + RUBY_RULES + DART_RULES + JAVA_RULES + PYTHON_RULES + PHP_RULES + GO_RULES + RUBY_RULES + DART_RULES ).freeze RULES_BY_LANG = { java: JAVA_RULES, javascript: JAVA_RULES, js: JAVA_RULES, - csharp: CSHARP_RULES, + csharp: JAVA_RULES, py: PYTHON_RULES, python: PYTHON_RULES, php: PHP_RULES, @@ -186,7 +178,7 @@ def self.supported # multi-line stack traces. class ExceptionDetector def initialize(*languages) - reset + @state = :start_state @rules = Hash.new { |h, k| h[k] = [] } languages = [:all] if languages.empty? @@ -220,8 +212,8 @@ def update(line) # defined transition for 'line', trigger another state transition because # 'line' may contain the beginning of another exception. transition(line) unless trace_seen_before - new_states = @states - trace_seen_after = new_states != Set[:start_state] + new_state = @state + trace_seen_after = new_state != :start_state case [trace_seen_before, trace_seen_after] when [true, true] @@ -236,7 +228,7 @@ def update(line) end def reset - @states = Set[:start_state] + @state = :start_state end private @@ -244,30 +236,14 @@ def reset # Executes a transition of the state machine for the given line. # Returns false if the line does not match any transition rule and the # state machine was reset to the initial state. - # - # The state machine may be in multiple distinct states at once to cope - # with the situation where the applicable rules aren't distinct enough - # to unambiguously determine a single state. The will occur, for example, - # for the start of a Java or C# exception, where the rules to transition - # to both the :java_start_exception and :csharp_start_exception would - # match. def transition(line) - new_states = Set.new - @states.each do |s| - @rules[s].each do |r| - next unless line =~ r.pattern - new_states << r.to_state - break unless s == :start_state - end - end - - if new_states.empty? - reset - return false - else - @states = new_states + @rules[@state].each do |r| + next unless line =~ r.pattern + @state = r.to_state return true end + @state = :start_state + false end end From 6ea0cb7f6d935668782073d3bd4770c24c3ddcc2 Mon Sep 17 00:00:00 2001 From: Eadred Birchenough Date: Tue, 13 Aug 2019 08:53:12 +0100 Subject: [PATCH 6/8] Handling for complex .Net aggregate exception Handles multiple inner exceptions --- lib/fluent/plugin/exception_detector.rb | 2 +- test/plugin/test_exception_detector.rb | 30 ++++++++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index b734fb5..2a44322 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -57,7 +57,7 @@ def self.supported :java_after_exception), rule(:java_after_exception, /^[\t ]*nested exception is:[\t ]*/, :java_start_exception), - rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), + rule([:java_after_exception, :java], /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), # C# nested exception diff --git a/test/plugin/test_exception_detector.rb b/test/plugin/test_exception_detector.rb index 17a5516..ddc08ba 100644 --- a/test/plugin/test_exception_detector.rb +++ b/test/plugin/test_exception_detector.rb @@ -268,20 +268,24 @@ class ExceptionDetectorTest < Test::Unit::TestCase END CSHARP_AGGREGATE_EXC = < System.InvalidOperationException: This is an exception - at ExampleApp.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 28 - at ExampleApp.AsyncExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 23 - at ExampleApp.AsyncExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 17 - at ExampleApp.AsyncExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 12 +System.AggregateException: One or more errors occurred. (Something went wrong with number 1) (Something went wrong with number 2) (Something went wrong with number 3) ---> System.InvalidOperationException: Something went wrong with number 1 + at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 + at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34 --- End of inner exception stack trace --- - at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) - at System.Threading.Tasks.Task.Wait() - at ExampleApp.Program.Main(String[] args) in c:/ExampleApp/ExampleApp/Program.cs:line 12 ----> (Inner Exception #0) System.InvalidOperationException: This is an exception - at ExampleApp.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 28 - at ExampleApp.AsyncExceptionExample.ThirdLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 23 - at ExampleApp.AsyncExceptionExample.SecondLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 17 - at ExampleApp.AsyncExceptionExample.TopLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 12<--- + at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) + at System.Threading.Tasks.Task.WaitAll(Task[] tasks) + at ExampleApp.AggregateExceptionExample.TopLevelMethod() in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 15 +---> (Inner Exception #0) System.InvalidOperationException: Something went wrong with number 1 + at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 + at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- + +---> (Inner Exception #1) System.InvalidOperationException: Something went wrong with number 2 + at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 + at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- + +---> (Inner Exception #2) System.InvalidOperationException: Something went wrong with number 3 + at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 + at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- END CSHARP_ASYNC_EXC = < Date: Tue, 13 Aug 2019 09:04:27 +0100 Subject: [PATCH 7/8] Removed handling for .Net aggregate exceptions This is pending https://issuetracker.google.com/issues/139292720 --- lib/fluent/plugin/exception_detector.rb | 7 +------ test/plugin/test_exception_detector.rb | 23 ----------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 2a44322..4cecec2 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -57,7 +57,7 @@ def self.supported :java_after_exception), rule(:java_after_exception, /^[\t ]*nested exception is:[\t ]*/, :java_start_exception), - rule([:java_after_exception, :java], /^[\r\n]*$/, :java_after_exception), + rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), # C# nested exception @@ -65,11 +65,6 @@ def self.supported /^[\t ]+--- End of inner exception stack trace ---/, :java), - # C# aggregate exception - rule([:java_after_exception, :java], - /^---> \(Inner Exception #[0-9]+\)/, - :java), - # C# exception from async code rule([:java_after_exception, :java], /^---\sEnd\sof\sstack\strace\sfrom\sprevious\s diff --git a/test/plugin/test_exception_detector.rb b/test/plugin/test_exception_detector.rb index ddc08ba..a77885d 100644 --- a/test/plugin/test_exception_detector.rb +++ b/test/plugin/test_exception_detector.rb @@ -267,27 +267,6 @@ class ExceptionDetectorTest < Test::Unit::TestCase at ExampleApp.Program.Main(String[] args) in c:/ExampleApp/ExampleApp/Program.cs:line 11 END - CSHARP_AGGREGATE_EXC = < System.InvalidOperationException: Something went wrong with number 1 - at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 - at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34 - --- End of inner exception stack trace --- - at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) - at System.Threading.Tasks.Task.WaitAll(Task[] tasks) - at ExampleApp.AggregateExceptionExample.TopLevelMethod() in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 15 ----> (Inner Exception #0) System.InvalidOperationException: Something went wrong with number 1 - at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 - at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- - ----> (Inner Exception #1) System.InvalidOperationException: Something went wrong with number 2 - at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 - at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- - ----> (Inner Exception #2) System.InvalidOperationException: Something went wrong with number 3 - at ExampleApp.AggregateExceptionExample.InnerMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 39 - at ExampleApp.AggregateExceptionExample.ParallelMethod(Int32 someNumber) in C:\ExampleApp\ExampleApp\AggregateExceptionExample.cs:line 34<--- -END - CSHARP_ASYNC_EXC = < Date: Tue, 20 Aug 2019 07:37:52 +0100 Subject: [PATCH 8/8] PR review changes --- lib/fluent/plugin/exception_detector.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index 4cecec2..ee47184 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -60,15 +60,15 @@ def self.supported rule(:java_after_exception, /^[\r\n]*$/, :java_after_exception), rule([:java_after_exception, :java], /^[\t ]+(?:eval )?at /, :java), - # C# nested exception rule([:java_after_exception, :java], - /^[\t ]+--- End of inner exception stack trace ---/, + # C# nested exception. + /^[\t ]+--- End of inner exception stack trace ---$/, :java), - # C# exception from async code rule([:java_after_exception, :java], - /^---\sEnd\sof\sstack\strace\sfrom\sprevious\s - location\swhere\sexception\swas\sthrown\s---/x, + # C# exception from async code. + /^--- End of stack trace from previous (?x: + )location where exception was thrown ---$/, :java), rule([:java_after_exception, :java], /^[\t ]*(?:Caused by|Suppressed):/,