diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e79036a..ab5ea57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,8 @@ jobs: fail-fast: false matrix: rvm: + - 2.7 - 2.6 - - 2.5 - - 2.4 runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -32,4 +31,3 @@ jobs: # - google-fluentd-notifications+travis@google.com # on_success: change # on_failure: change - diff --git a/.rubocop.yml b/.rubocop.yml index 7662da9..03a7579 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,14 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +AllCops: + TargetRubyVersion: 2.6 + NewCops: disable + +# Rakefile doesn't need to be executable. +Lint/ScriptPermission: + Enabled: false + # Offense count: 2 Metrics/AbcSize: Max: 120 @@ -31,3 +39,12 @@ Metrics/MethodLength: # Offense count: 3 Metrics/PerceivedComplexity: Max: 50 + +# Offense count: 1 +# Configuration parameters: CountComments. +Metrics/BlockLength: + Max: 50 + +# TODO: Re-enable this and fix frozen strings. +Style/FrozenStringLiteralComment: + Enabled: false diff --git a/Rakefile b/Rakefile index 959b345..33a9810 100644 --- a/Rakefile +++ b/Rakefile @@ -36,6 +36,7 @@ task :fix_perms do files.each do |file| mode = File.stat(file).mode & 0o777 next unless mode & 0o444 != 0o444 + puts "Changing mode of #{file} from #{mode.to_s(8)} to "\ "#{(mode | 0o444).to_s(8)}" chmod mode | 0o444, file @@ -43,6 +44,6 @@ task :fix_perms do end desc 'Run unit tests and RuboCop to check for style violations' -task all: [:test, :rubocop, :fix_perms] +task all: %i[rubocop test fix_perms] task default: :all diff --git a/fluent-plugin-detect-exceptions.gemspec b/fluent-plugin-detect-exceptions.gemspec index e177575..9003bc9 100644 --- a/fluent-plugin-detect-exceptions.gemspec +++ b/fluent-plugin-detect-exceptions.gemspec @@ -1,20 +1,20 @@ Gem::Specification.new do |gem| gem.name = 'fluent-plugin-detect-exceptions' - gem.description = <<-eos + gem.description = <<-DESCRIPTION Fluentd output plugin which detects exception stack traces in a stream of JSON log messages and combines all single-line messages that belong to the same stack trace into one multi-line message. This is an official Google Ruby gem. -eos + DESCRIPTION gem.summary = \ 'fluentd output plugin for combining stack traces as multi-line JSON logs' gem.homepage = \ 'https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions' gem.license = 'Apache-2.0' - gem.version = '0.0.14' + gem.version = '0.0.15' gem.authors = ['Stackdriver Agents'] gem.email = ['stackdriver-agents@google.com'] - gem.required_ruby_version = Gem::Requirement.new('>= 2.0') + gem.required_ruby_version = Gem::Requirement.new('>= 2.6') gem.files = Dir['**/*'].keep_if { |file| File.file?(file) } gem.test_files = gem.files.grep(/^(test)/) @@ -22,8 +22,8 @@ eos gem.add_runtime_dependency 'fluentd', '>= 0.10' + gem.add_development_dependency 'flexmock', '~> 2.0' gem.add_development_dependency 'rake', '~> 10.3' - gem.add_development_dependency 'rubocop', '= 0.42.0' + gem.add_development_dependency 'rubocop', '= 1.48.1' gem.add_development_dependency 'test-unit', '~> 3.0' - gem.add_development_dependency 'flexmock', '~> 2.0' end diff --git a/lib/fluent/plugin/exception_detector.rb b/lib/fluent/plugin/exception_detector.rb index d000e22..5dff026 100644 --- a/lib/fluent/plugin/exception_detector.rb +++ b/lib/fluent/plugin/exception_detector.rb @@ -21,9 +21,9 @@ module ExceptionDetectorConfig class RuleTarget attr_accessor :pattern, :to_state - def initialize(p, s) - @pattern = p - @to_state = s + def initialize(pattern, state) + @pattern = pattern + @to_state = state end def ==(other) @@ -52,28 +52,28 @@ def self.supported end JAVA_RULES = [ - rule([:start_state, :java_start_exception], + rule(%i[start_state java_start_exception], /(?:Exception|Error|Throwable|V8 errors stack trace)[:\r\n]/, :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], /^[\t !]+(?:eval )?at /, :java), + rule(%i[java_after_exception java], /^[\t !]+(?:eval )?at /, :java), - rule([:java_after_exception, :java], + rule(%i[java_after_exception java], # C# nested exception. /^[\t !]+--- End of inner exception stack trace ---$/, :java), - rule([:java_after_exception, :java], + rule(%i[java_after_exception java], # 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):/, + rule(%i[java_after_exception java], /^[\t !]*(?:Caused by|Suppressed):/, :java_after_exception), - rule([:java_after_exception, :java], + rule(%i[java_after_exception java], /^[\t !]*... \d+ (?:more|common frames omitted)/, :java) ].freeze @@ -94,16 +94,16 @@ def self.supported ].freeze GO_RULES = [ - rule([:start_state, :go_after_panic], /\bpanic: /, :go_after_panic), + rule(:start_state, :go_after_panic], /\bpanic: /, :go_after_panic), rule(:start_state, /http: panic serving/, :go_goroutine), rule(:go_after_panic, /^$/, :go_goroutine), - rule([:go_after_panic, :go_after_signal, :go_frame_1], + rule(%i[go_after_panic go_after_signal go_frame_line1], /^$/, :go_goroutine), rule(:go_after_panic, /^\[signal /, :go_after_signal), - rule(:go_goroutine, /^goroutine \d+ \[[^\]]+\]:$/, :go_frame_1), - rule(:go_frame_1, /^(?:[^\s.:]+\.\.?)*[^\s.():]+\(|^created by /, - :go_frame_2), - rule(:go_frame_2, /^\s/, :go_frame_1) + rule(:go_goroutine, /^goroutine \d+ \[[^\]]+\]:$/, :go_frame_line1), + rule(:go_frame_line1, /^(?:[^\s.:]+\.\.?)*[^\s.():]+\(|^created by /, + :go_frame_line2), + rule(:go_frame_line2, /^\s/, :go_frame_line1) ].freeze RUBY_RULES = [ @@ -129,22 +129,22 @@ def self.supported rule(:dart_exc, /^Concurrent modification/, :dart_stack), rule(:dart_exc, /^Out of Memory/, :dart_stack), rule(:dart_exc, /^Stack Overflow/, :dart_stack), - rule(:dart_exc, /^'.+?':.+?$/, :dart_type_err_1), - rule(:dart_type_err_1, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), - rule(:dart_type_err_1, /^.+?$/, :dart_type_err_2), - rule(:dart_type_err_2, /^.*?\^.*?$/, :dart_type_err_3), - rule(:dart_type_err_3, /^$/, :dart_type_err_4), - rule(:dart_type_err_4, /^$/, :dart_stack), - rule(:dart_exc, /^FormatException/, :dart_format_err_1), - rule(:dart_format_err_1, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), - rule(:dart_format_err_1, /^./, :dart_format_err_2), - rule(:dart_format_err_2, /^.*?\^/, :dart_format_err_3), - rule(:dart_format_err_3, /^$/, :dart_stack), - rule(:dart_exc, /^NoSuchMethodError:/, :dart_method_err_1), - rule(:dart_method_err_1, /^Receiver:/, :dart_method_err_2), - rule(:dart_method_err_2, /^Tried calling:/, :dart_method_err_3), - rule(:dart_method_err_3, /^Found:/, :dart_stack), - rule(:dart_method_err_3, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), + rule(:dart_exc, /^'.+?':.+?$/, :dart_type_err_line1), + rule(:dart_type_err_line1, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), + rule(:dart_type_err_line1, /^.+?$/, :dart_type_err_line2), + rule(:dart_type_err_line2, /^.*?\^.*?$/, :dart_type_err_line3), + rule(:dart_type_err_line3, /^$/, :dart_type_err_line4), + rule(:dart_type_err_line4, /^$/, :dart_stack), + rule(:dart_exc, /^FormatException/, :dart_format_err_line1), + rule(:dart_format_err_line1, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), + rule(:dart_format_err_line1, /^./, :dart_format_err_line2), + rule(:dart_format_err_line2, /^.*?\^/, :dart_format_err_line3), + rule(:dart_format_err_line3, /^$/, :dart_stack), + rule(:dart_exc, /^NoSuchMethodError:/, :dart_method_err_line1), + rule(:dart_method_err_line1, /^Receiver:/, :dart_method_err_line2), + rule(:dart_method_err_line2, /^Tried calling:/, :dart_method_err_line3), + rule(:dart_method_err_line3, /^Found:/, :dart_stack), + rule(:dart_method_err_line3, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), rule(:dart_stack, /^#\d+\s+.+?\(.+?\)$/, :dart_stack), rule(:dart_stack, /^$/, :dart_stack) ].freeze @@ -168,7 +168,7 @@ def self.supported all: ALL_RULES }.freeze - DEFAULT_FIELDS = %w(message log).freeze + DEFAULT_FIELDS = %w[message log].freeze end # State machine that consumes individual log lines and detects @@ -236,6 +236,7 @@ def reset def transition(line) @rules[@state].each do |r| next unless line =~ r.pattern + @state = r.to_state return true end @@ -280,14 +281,14 @@ def push(time_sec, record) @exception_detector.reset detection_status = :no_trace else - force_flush if @max_bytes > 0 && + force_flush if @max_bytes.positive? && @buffer_size + message.length > @max_bytes detection_status = @exception_detector.update(message) end update_buffer(detection_status, time_sec, record, message) - force_flush if @max_lines > 0 && @messages.length == @max_lines + force_flush if @max_lines.positive? && @messages.length == @max_lines end def flush @@ -332,8 +333,7 @@ def extract_message(record) end def update_buffer(detection_status, time_sec, record, message) - trigger_emit = detection_status == :no_trace || - detection_status == :end_trace + trigger_emit = %i[no_trace end_trace].include?(detection_status) if @messages.empty? && trigger_emit @emit.call(time_sec, record) return @@ -361,16 +361,16 @@ def add(time_sec, record, message) @first_timestamp = time_sec @buffer_start_time = Time.now end - unless message.nil? - message_with_line_break = - if @force_line_breaks && !@messages.empty? && !message.include?("\n") - "\n" + message - else - message - end - @messages << message_with_line_break - @buffer_size += message_with_line_break.length - end + return if message.nil? + + message_with_line_break = + if @force_line_breaks && !@messages.empty? && !message.include?("\n") + "\n#{message}" + else + message + end + @messages << message_with_line_break + @buffer_size += message_with_line_break.length end end end diff --git a/lib/fluent/plugin/out_detect_exceptions.rb b/lib/fluent/plugin/out_detect_exceptions.rb index 98c4785..64c592d 100644 --- a/lib/fluent/plugin/out_detect_exceptions.rb +++ b/lib/fluent/plugin/out_detect_exceptions.rb @@ -48,9 +48,7 @@ def multi_workers_ready? def configure(conf) super - if multiline_flush_interval - @check_flush_interval = [multiline_flush_interval * 0.1, 1].max - end + @check_flush_interval = [multiline_flush_interval * 0.1, 1].max if multiline_flush_interval @languages = languages.map(&:to_sym) @@ -61,11 +59,11 @@ def configure(conf) def start super - if multiline_flush_interval - @flush_buffer_mutex = Mutex.new - @stop_check = false - @thread = Thread.new(&method(:check_flush_loop)) - end + return unless multiline_flush_interval + + @flush_buffer_mutex = Mutex.new + @stop_check = false + @thread = Thread.new(&method(:check_flush_loop)) end def before_shutdown @@ -81,8 +79,8 @@ def shutdown super end - def emit(tag, es, chain) - es.each do |time_sec, record| + def emit(tag, entries, chain) + entries.each do |time_sec, record| process_record(tag, time_sec, record) end chain.next @@ -125,13 +123,14 @@ def check_flush_loop @flush_buffer_mutex.sleep(@check_flush_interval) now = Time.now break if @stop_check + @accumulators.each_value do |acc| acc.force_flush if now - acc.buffer_start_time > @multiline_flush_interval end end end - rescue + rescue StandardError log.error 'error in check_flush_loop', error: $ERROR_INFO.to_s log.error_backtrace end diff --git a/test/helper.rb b/test/helper.rb index de79700..b0a7a91 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -14,29 +14,29 @@ require 'rubygems' require 'bundler' - begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e + # rubocop:disable Style/StderrPuts $stderr.puts e.message $stderr.puts 'Run `bundle install` to install missing gems' + # rubocop:enable Style/StderrPuts exit e.status_code end - require 'test/unit' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'fluent/test' - unless ENV.key?('VERBOSE') nulllogger = Object.new nulllogger.instance_eval do |_| - def respond_to_missing? + def respond_to_missing?(_method, _include_private = false) true end - def method_missing(_method, *_args) # rubocop:disable Style/MethodMissing + def method_missing(_method, *_args) + # pass end end # global $log variable is used by fluentd diff --git a/test/plugin/bench_exception_detector.rb b/test/plugin/bench_exception_detector.rb index e00f5a6..d103387 100644 --- a/test/plugin/bench_exception_detector.rb +++ b/test/plugin/bench_exception_detector.rb @@ -21,25 +21,25 @@ size = size_in_m << 20 -JAVA_EXC = <... Relaying denied - - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:236) - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:285) - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.lambda$sendSingleEmail$3(AutomaticEmailFacade.java:254) - at java.util.Optional.ifPresent(Optional.java:159) - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:253) - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:249) - at com.nethunt.crm.api.email.EmailSender.lambda$notifyPerson$0(EmailSender.java:80) - at com.nethunt.crm.api.util.ManagedExecutor.lambda$execute$0(ManagedExecutor.java:36) - at com.nethunt.crm.api.util.RequestContextActivator.lambda$withRequestContext$0(RequestContextActivator.java:36) - at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.base/java.lang.Thread.run(Thread.java:748) -Caused by: javax.mail.SendFailedException: Invalid Addresses; - nested exception is: -com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied - - at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:2064) - at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1286) - at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:229) - ... 12 more -Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied -END - - NODE_JS_EXC = <:3:9) - at :6:4 - at a_function_name - at Object.InjectedScript._evaluateOn (http:///file.js?foo=bar:875:140) - at Object.InjectedScript.evaluate () -END - - V8_JS_EXC = <__call('raise', Array) -#3 /base/data/home/apps/s~crash-example-php/1.388306779641080894/index.php(36): ErrorEntry->raise() -#4 {main} - thrown in /base/data/home/apps/s~crash-example-php/1.388306779641080894/errors.php on line 60 -END - - GO_EXC = <:0 - at File3.Consolidator_Class.Function5 (System.Collections.Generic.Dictionary`2 names, System.Text.StringBuilder param_4) [0x00007] in /usr/local/google/home/Csharp/another file.csharp:9 - at File3.Consolidator_Class.Function4 (System.Text.StringBuilder param_4, System.Double[,,] array) [0x00013] in /usr/local/google/home/Csharp/another file.csharp:23 - at File3.Consolidator_Class.Function3 (Int32 param_3) [0x0000f] in /usr/local/google/home/Csharp/another file.csharp:27 - at File3.Consolidator_Class.Function3 (System.Text.StringBuilder param_3) [0x00007] in /usr/local/google/home/Csharp/another file.csharp:32 - at File2.Processor.Function2 (System.Int32& param_2, System.Collections.Generic.Stack`1& numbers) [0x00003] in /usr/local/google/home/Csharp/File2.csharp:19 - at File2.Processor.Random2 () [0x00037] in /usr/local/google/home/Csharp/File2.csharp:28 - at File2.Processor.Function1 (Int32 param_1, System.Collections.Generic.Dictionary`2 map) [0x00007] in /usr/local/google/home/Csharp/File2.csharp:34 - at Main.Welcome+
c__AnonStorey0.<>m__0 () [0x00006] in /usr/local/google/home/Csharp/hello.csharp:48 - 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_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 = <... Relaying denied + + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:236) + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:285) + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.lambda$sendSingleEmail$3(AutomaticEmailFacade.java:254) + at java.util.Optional.ifPresent(Optional.java:159) + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:253) + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendSingleEmail(AutomaticEmailFacade.java:249) + at com.nethunt.crm.api.email.EmailSender.lambda$notifyPerson$0(EmailSender.java:80) + at com.nethunt.crm.api.util.ManagedExecutor.lambda$execute$0(ManagedExecutor.java:36) + at com.nethunt.crm.api.util.RequestContextActivator.lambda$withRequestContext$0(RequestContextActivator.java:36) + at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) + at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) + at java.base/java.lang.Thread.run(Thread.java:748) + Caused by: javax.mail.SendFailedException: Invalid Addresses; + nested exception is: + com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied + + at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:2064) + at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1286) + at com.nethunt.crm.api.server.adminsync.AutomaticEmailFacade.sendWithSmtp(AutomaticEmailFacade.java:229) + ... 12 more + Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <[REDACTED_EMAIL_ADDRESS]>... Relaying denied + END_NESTED_JAVA + + NODE_JS_EXC = <<~END_NODE_JS.freeze + ReferenceError: myArray is not defined + at next (/app/node_modules/express/lib/router/index.js:256:14) + at /app/node_modules/express/lib/router/index.js:615:15 + at next (/app/node_modules/express/lib/router/index.js:271:10) + at Function.process_params (/app/node_modules/express/lib/router/index.js:330:12) + at /app/node_modules/express/lib/router/index.js:277:22 + at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) + at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3) + at next (/app/node_modules/express/lib/router/route.js:131:13) + at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) + at /app/app.js:52:3 + END_NODE_JS + + CLIENT_JS_EXC = <<~END_CLIENT_JS.freeze + Error + at bls (:3:9) + at :6:4 + at a_function_name + at Object.InjectedScript._evaluateOn (http:///file.js?foo=bar:875:140) + at Object.InjectedScript.evaluate () + END_CLIENT_JS + + V8_JS_EXC = <<~END_V8_JS.freeze + V8 errors stack trace + eval at Foo.a (eval at Bar.z (myscript.js:10:3)) + at new Contructor.Name (native) + at new FunctionName (unknown location) + at Type.functionName [as methodName] (file(copy).js?query='yes':12:9) + at functionName [as methodName] (native) + at Type.main(sample(copy).js:6:4) + END_V8_JS + + PYTHON_EXC = <<~END_PYTHON.freeze + Traceback (most recent call last): + File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__ + rv = self.handle_exception(request, response, e) + File "/base/data/home/apps/s~nearfieldspy/1.378705245900539993/nearfieldspy.py", line 17, in start + return get() + File "/base/data/home/apps/s~nearfieldspy/1.378705245900539993/nearfieldspy.py", line 5, in get + raise Exception('spam', 'eggs') + Exception: ('spam', 'eggs') + END_PYTHON + + PHP_EXC = <<~END_PHP.freeze + exception 'Exception' with message 'Custom exception' in /home/joe/work/test-php/test.php:5 + Stack trace: + #0 /home/joe/work/test-php/test.php(9): func1() + #1 /home/joe/work/test-php/test.php(13): func2() + #2 {main} + END_PHP + + PHP_ON_GAE_EXC = <<~END_PHP_ON_GAE.freeze + PHP Fatal error: Uncaught exception 'Exception' with message 'message' in /base/data/home/apps/s~crash-example-php/1.388306779641080894/errors.php:60 + Stack trace: + #0 [internal function]: ErrorEntryGenerator::{closure}() + #1 /base/data/home/apps/s~crash-example-php/1.388306779641080894/errors.php(20): call_user_func_array(Object(Closure), Array) + #2 /base/data/home/apps/s~crash-example-php/1.388306779641080894/index.php(36): ErrorEntry->__call('raise', Array) + #3 /base/data/home/apps/s~crash-example-php/1.388306779641080894/index.php(36): ErrorEntry->raise() + #4 {main} + thrown in /base/data/home/apps/s~crash-example-php/1.388306779641080894/errors.php on line 60 + END_PHP_ON_GAE + + GO_EXC = <<~END_GO.freeze + panic: my panic + + goroutine 4 [running]: + panic(0x45cb40, 0x47ad70) + /usr/local/go/src/runtime/panic.go:542 +0x46c fp=0xc42003f7b8 sp=0xc42003f710 pc=0x422f7c + main.main.func1(0xc420024120) + foo.go:6 +0x39 fp=0xc42003f7d8 sp=0xc42003f7b8 pc=0x451339 + runtime.goexit() + /usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc42003f7e0 sp=0xc42003f7d8 pc=0x44b4d1 + created by main.main + foo.go:5 +0x58 + + goroutine 1 [chan receive]: + runtime.gopark(0x4739b8, 0xc420024178, 0x46fcd7, 0xc, 0xc420028e17, 0x3) + /usr/local/go/src/runtime/proc.go:280 +0x12c fp=0xc420053e30 sp=0xc420053e00 pc=0x42503c + runtime.goparkunlock(0xc420024178, 0x46fcd7, 0xc, 0x1000f010040c217, 0x3) + /usr/local/go/src/runtime/proc.go:286 +0x5e fp=0xc420053e70 sp=0xc420053e30 pc=0x42512e + runtime.chanrecv(0xc420024120, 0x0, 0xc420053f01, 0x4512d8) + /usr/local/go/src/runtime/chan.go:506 +0x304 fp=0xc420053f20 sp=0xc420053e70 pc=0x4046b4 + runtime.chanrecv1(0xc420024120, 0x0) + /usr/local/go/src/runtime/chan.go:388 +0x2b fp=0xc420053f50 sp=0xc420053f20 pc=0x40439b + main.main() + foo.go:9 +0x6f fp=0xc420053f80 sp=0xc420053f50 pc=0x4512ef + runtime.main() + /usr/local/go/src/runtime/proc.go:185 +0x20d fp=0xc420053fe0 sp=0xc420053f80 pc=0x424bad + runtime.goexit() + /usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420053fe8 sp=0xc420053fe0 pc=0x44b4d1 + + goroutine 2 [force gc (idle)]: + runtime.gopark(0x4739b8, 0x4ad720, 0x47001e, 0xf, 0x14, 0x1) + /usr/local/go/src/runtime/proc.go:280 +0x12c fp=0xc42003e768 sp=0xc42003e738 pc=0x42503c + runtime.goparkunlock(0x4ad720, 0x47001e, 0xf, 0xc420000114, 0x1) + /usr/local/go/src/runtime/proc.go:286 +0x5e fp=0xc42003e7a8 sp=0xc42003e768 pc=0x42512e + runtime.forcegchelper() + /usr/local/go/src/runtime/proc.go:238 +0xcc fp=0xc42003e7e0 sp=0xc42003e7a8 pc=0x424e5c + runtime.goexit() + /usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc42003e7e8 sp=0xc42003e7e0 pc=0x44b4d1 + created by runtime.init.4 + /usr/local/go/src/runtime/proc.go:227 +0x35 + + goroutine 3 [GC sweep wait]: + runtime.gopark(0x4739b8, 0x4ad7e0, 0x46fdd2, 0xd, 0x419914, 0x1) + /usr/local/go/src/runtime/proc.go:280 +0x12c fp=0xc42003ef60 sp=0xc42003ef30 pc=0x42503c + runtime.goparkunlock(0x4ad7e0, 0x46fdd2, 0xd, 0x14, 0x1) + /usr/local/go/src/runtime/proc.go:286 +0x5e fp=0xc42003efa0 sp=0xc42003ef60 pc=0x42512e + runtime.bgsweep(0xc42001e150) + /usr/local/go/src/runtime/mgcsweep.go:52 +0xa3 fp=0xc42003efd8 sp=0xc42003efa0 pc=0x419973 + runtime.goexit() + /usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc42003efe0 sp=0xc42003efd8 pc=0x44b4d1 + created by runtime.gcenable + /usr/local/go/src/runtime/mgc.go:216 +0x58 + END_GO + + GO_ON_GAE_EXC = <<~END_GO_ON_GAE.freeze + panic: runtime error: index out of range + + goroutine 12 [running]: + main88989.memoryAccessException() + crash_example_go.go:58 +0x12a + main88989.handler(0x2afb7042a408, 0xc01042f880, 0xc0104d3450) + crash_example_go.go:36 +0x7ec + net/http.HandlerFunc.ServeHTTP(0x13e5128, 0x2afb7042a408, 0xc01042f880, 0xc0104d3450) + go/src/net/http/server.go:1265 +0x56 + net/http.(*ServeMux).ServeHTTP(0xc01045cab0, 0x2afb7042a408, 0xc01042f880, 0xc0104d3450) + go/src/net/http/server.go:1541 +0x1b4 + appengine_internal.executeRequestSafely(0xc01042f880, 0xc0104d3450) + go/src/appengine_internal/api_prod.go:288 +0xb7 + appengine_internal.(*server).HandleRequest(0x15819b0, 0xc010401560, 0xc0104c8180, 0xc010431380, 0x0, 0x0) + go/src/appengine_internal/api_prod.go:222 +0x102b + reflect.Value.call(0x1243fe0, 0x15819b0, 0x113, 0x12c8a20, 0x4, 0xc010485f78, 0x3, 0x3, 0x0, 0x0, ...) + /tmp/appengine/go/src/reflect/value.go:419 +0x10fd + reflect.Value.Call(0x1243fe0, 0x15819b0, 0x113, 0xc010485f78, 0x3, 0x3, 0x0, 0x0, 0x0) + /tmp/ap + END_GO_ON_GAE + + GO_SIGNAL_EXC = <<~END_GO_SIGNAL.freeze + panic: runtime error: invalid memory address or nil pointer dereference + [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fd34f] + + goroutine 5 [running]: + panics.nilPtrDereference() + panics/panics.go:33 +0x1f + panics.Wait() + panics/panics.go:16 +0x3b + created by main.main + server.go:20 +0x91 + END_GO_SIGNAL + + GO_HTTP = <<~END_GO_HTTP.freeze + 2019/01/15 07:48:05 http: panic serving [::1]:54143: test panic + goroutine 24 [running]: + net/http.(*conn).serve.func1(0xc00007eaa0) + /usr/local/go/src/net/http/server.go:1746 +0xd0 + panic(0x12472a0, 0x12ece10) + /usr/local/go/src/runtime/panic.go:513 +0x1b9 + main.doPanic(0x12f0ea0, 0xc00010e1c0, 0xc000104400) + /Users/ingvar/src/go/src/httppanic.go:8 +0x39 + net/http.HandlerFunc.ServeHTTP(0x12be2e8, 0x12f0ea0, 0xc00010e1c0, 0xc000104400) + /usr/local/go/src/net/http/server.go:1964 +0x44 + net/http.(*ServeMux).ServeHTTP(0x14a17a0, 0x12f0ea0, 0xc00010e1c0, 0xc000104400) + /usr/local/go/src/net/http/server.go:2361 +0x127 + net/http.serverHandler.ServeHTTP(0xc000085040, 0x12f0ea0, 0xc00010e1c0, 0xc000104400) + /usr/local/go/src/net/http/server.go:2741 +0xab + net/http.(*conn).serve(0xc00007eaa0, 0x12f10a0, 0xc00008a780) + /usr/local/go/src/net/http/server.go:1847 +0x646 + created by net/http.(*Server).Serve + /usr/local/go/src/net/http/server.go:2851 +0x2f5 + END_GO_HTTP + + CSHARP_EXC = <<~END_CSHARP.freeze + System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. + at System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.Int32,System.Double]].get_Item (System.String key) [0x00000] in :0 + at File3.Consolidator_Class.Function5 (System.Collections.Generic.Dictionary`2 names, System.Text.StringBuilder param_4) [0x00007] in /usr/local/google/home/Csharp/another file.csharp:9 + at File3.Consolidator_Class.Function4 (System.Text.StringBuilder param_4, System.Double[,,] array) [0x00013] in /usr/local/google/home/Csharp/another file.csharp:23 + at File3.Consolidator_Class.Function3 (Int32 param_3) [0x0000f] in /usr/local/google/home/Csharp/another file.csharp:27 + at File3.Consolidator_Class.Function3 (System.Text.StringBuilder param_3) [0x00007] in /usr/local/google/home/Csharp/another file.csharp:32 + at File2.Processor.Function2 (System.Int32& param_2, System.Collections.Generic.Stack`1& numbers) [0x00003] in /usr/local/google/home/Csharp/File2.csharp:19 + at File2.Processor.Random2 () [0x00037] in /usr/local/google/home/Csharp/File2.csharp:28 + at File2.Processor.Function1 (Int32 param_1, System.Collections.Generic.Dictionary`2 map) [0x00007] in /usr/local/google/home/Csharp/File2.csharp:34 + at Main.Welcome+
c__AnonStorey0.<>m__0 () [0x00006] in /usr/local/google/home/Csharp/hello.csharp:48 + at System.Threading.Thread.StartInternal () [0x00000] in :0 + END_CSHARP + + CSHARP_NESTED_EXC = <<~END_CSHARP_NESTED.freeze + System.InvalidOperationException: This is the outer exception ---> 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_NESTED + + CSHARP_ASYNC_EXC = <<~END_CSHARP_ASYNC.freeze + System.InvalidOperationException: This is an exception + at ExampleApp2.AsyncExceptionExample.LowestLevelMethod() in c:/ExampleApp/ExampleApp/AsyncExceptionExample.cs:line 36 + at ExampleApp2.AsyncExceptionExample.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_CSHARP_ASYNC + + RUBY_EXC = <): app/controllers/books_controller.rb:69:in `recursivewordload' app/controllers/books_controller.rb:75:in `loadword' @@ -339,13 +316,13 @@ class ExceptionDetectorTest < Test::Unit::TestCase app/controllers/books_controller.rb:99:in `requestload' app/controllers/books_controller.rb:118:in `generror' config/error_reporting_logger.rb:62:in `tagged' -END +END_RUBY # The whitespace on the second line is significant. - # rubocop:disable TrailingWhitespace - RAILS_EXC = < (file:///path/to/code/dartFile.dart:15:20) -#1 printError (file:///path/to/code/dartFile.dart:37:13) -#2 main (file:///path/to/code/dartFile.dart:15:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_EXC = < (file:///path/to/code/dartFile.dart:17:20) -#1 printError (file:///path/to/code/dartFile.dart:37:13) -#2 main (file:///path/to/code/dartFile.dart:17:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_ASYNC_ERR = < -#2 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_DIVIDE_BY_ZERO_ERR = < (file:///path/to/code/dartFile.dart:27:20) -#1 printError (file:///path/to/code/dartFile.dart:42:13) -#2 main (file:///path/to/code/dartFile.dart:27:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_ARGUMENT_ERR = < (file:///path/to/code/dartFile.dart:23:20) -#1 printError (file:///path/to/code/dartFile.dart:42:13) -#2 main (file:///path/to/code/dartFile.dart:23:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_RANGE_ERR = < (file:///path/to/code/dartFile.dart:31:23) -#2 printError (file:///path/to/code/dartFile.dart:42:13) -#3 main (file:///path/to/code/dartFile.dart:29:3) -#4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_ASSERTION_ERR = < (file:///path/to/code/dartFile.dart:9:20) -#1 printError (file:///path/to/code/dartFile.dart:36:13) -#2 main (file:///path/to/code/dartFile.dart:9:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_ABSTRACT_CLASS_ERR = < (file:///path/to/code/dartFile.dart:12:20) -#1 printError (file:///path/to/code/dartFile.dart:36:13) -#2 main (file:///path/to/code/dartFile.dart:12:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_READ_STATIC_ERR = < (file:///path/to/code/dartFile.dart:28:20) -#1 printError (file:///path/to/code/dartFile.dart:43:13) -#2 main (file:///path/to/code/dartFile.dart:28:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_UNIMPLEMENTED_ERROR = < (file:///path/to/code/dartFile.dart:38:20) -#1 printError (file:///path/to/code/dartFile.dart:61:13) -#2 main (file:///path/to/code/dartFile.dart:38:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_UNSUPPORTED_ERR = < (file:///path/to/code/dartFile.dart:36:20) -#1 printError (file:///path/to/code/dartFile.dart:61:13) -#2 main (file:///path/to/code/dartFile.dart:36:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_CONCURRENT_MODIFICATION_ERR = < (file:///path/to/code/dartFile.dart:35:20) -#1 printError (file:///path/to/code/dartFile.dart:61:13) -#2 main (file:///path/to/code/dartFile.dart:35:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_OOM_ERR = < (file:///path/to/code/dartFile.dart:34:20) -#1 printError (file:///path/to/code/dartFile.dart:61:13) -#2 main (file:///path/to/code/dartFile.dart:34:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_STACK_OVERFLOW_ERR = < (file:///path/to/code/dartFile.dart:33:20) -#1 printError (file:///path/to/code/dartFile.dart:61:13) -#2 main (file:///path/to/code/dartFile.dart:33:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_FALLTHROUGH_ERR = < (file:///path/to/code/dartFile.dart:39:20) -#1 printError (file:///path/to/code/dartFile.dart:51:13) -#2 main (file:///path/to/code/dartFile.dart:39:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_TYPE_ERR = < (file:///path/to/code/dartFile.dart:7:24) -#2 printError (file:///path/to/code/dartFile.dart:36:13) -#3 main (file:///path/to/code/dartFile.dart:7:3) -#4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_FORMAT_ERR = < (file:///path/to/code/dartFile.dart:25:20) -#1 printError (file:///path/to/code/dartFile.dart:42:13) -#2 main (file:///path/to/code/dartFile.dart:25:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_FORMAT_WITH_CODE_ERR = < (file:///path/to/code/dartFile.dart:24:20) -#1 printError (file:///path/to/code/dartFile.dart:42:13) -#2 main (file:///path/to/code/dartFile.dart:24:3) -#3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_NO_METHOD_ERR = < (file:///path/to/code/dartFile.dart:8:39) -#2 printError (file:///path/to/code/dartFile.dart:36:13) -#3 main (file:///path/to/code/dartFile.dart:8:3) -#4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - DART_NO_METHOD_GLOBAL_ERR = < (file:///path/to/code/dartFile.dart:10:20) -#2 printError (file:///path/to/code/dartFile.dart:36:13) -#3 main (file:///path/to/code/dartFile.dart:10:3) -#4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) -#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) -END - - ARBITRARY_TEXT = < (file:///path/to/code/dartFile.dart:15:20) + #1 printError (file:///path/to/code/dartFile.dart:37:13) + #2 main (file:///path/to/code/dartFile.dart:15:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART + + DART_EXC = <<~END_DART_EXC.freeze + Unhandled exception: + Exception: exception message + #0 main. (file:///path/to/code/dartFile.dart:17:20) + #1 printError (file:///path/to/code/dartFile.dart:37:13) + #2 main (file:///path/to/code/dartFile.dart:17:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_EXC + + DART_ASYNC_ERR = <<~END_DART_ASYNC.freeze + Unhandled exception: + Bad state: oops + #0 handleFailure (file:///test/example/http/handling_an_httprequest_error.dart:16:3) + #1 main (file:///test/example/http/handling_an_httprequest_error.dart:24:5) + + #2 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_ASYNC + + DART_DIVIDE_BY_ZERO_ERR = <<~END_DART_ZERO.freeze + Unhandled exception: + IntegerDivisionByZeroException + #0 main. (file:///path/to/code/dartFile.dart:27:20) + #1 printError (file:///path/to/code/dartFile.dart:42:13) + #2 main (file:///path/to/code/dartFile.dart:27:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_ZERO + + DART_ARGUMENT_ERR = <<~END_DART_ARG.freeze + Unhandled exception: + Invalid argument(s): invalid argument + #0 main. (file:///path/to/code/dartFile.dart:23:20) + #1 printError (file:///path/to/code/dartFile.dart:42:13) + #2 main (file:///path/to/code/dartFile.dart:23:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_ARG + + DART_RANGE_ERR = <<~END_DART_RANGE.freeze + Unhandled exception: + RangeError (index): Invalid value: Valid value range is empty: 1 + #0 List.[] (dart:core-patch/growable_array.dart:151) + #1 main. (file:///path/to/code/dartFile.dart:31:23) + #2 printError (file:///path/to/code/dartFile.dart:42:13) + #3 main (file:///path/to/code/dartFile.dart:29:3) + #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_RANGE + + DART_ASSERTION_ERR = <<~END_DART_ASSERT.freeze + Unhandled exception: + Assertion failed + #0 main. (file:///path/to/code/dartFile.dart:9:20) + #1 printError (file:///path/to/code/dartFile.dart:36:13) + #2 main (file:///path/to/code/dartFile.dart:9:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_ASSERT + + DART_ABSTRACT_CLASS_ERR = <<~END_DART_ABC.freeze + Unhandled exception: + Cannot instantiate abstract class LNClassName: _url 'null' line null + #0 main. (file:///path/to/code/dartFile.dart:12:20) + #1 printError (file:///path/to/code/dartFile.dart:36:13) + #2 main (file:///path/to/code/dartFile.dart:12:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_ABC + + DART_READ_STATIC_ERR = <<~END_DART_STATIC.freeze + Unhandled exception: + Reading static variable 'variable' during its initialization + #0 main. (file:///path/to/code/dartFile.dart:28:20) + #1 printError (file:///path/to/code/dartFile.dart:43:13) + #2 main (file:///path/to/code/dartFile.dart:28:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_STATIC + + DART_UNIMPLEMENTED_ERROR = <<~END_DART_UNIMPL.freeze + Unhandled exception: + UnimplementedError: unimplemented + #0 main. (file:///path/to/code/dartFile.dart:38:20) + #1 printError (file:///path/to/code/dartFile.dart:61:13) + #2 main (file:///path/to/code/dartFile.dart:38:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_UNIMPL + + DART_UNSUPPORTED_ERR = <<~END_DART_UNSUPPORTED.freeze + Unhandled exception: + Unsupported operation: unsupported + #0 main. (file:///path/to/code/dartFile.dart:36:20) + #1 printError (file:///path/to/code/dartFile.dart:61:13) + #2 main (file:///path/to/code/dartFile.dart:36:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_UNSUPPORTED + + DART_CONCURRENT_MODIFICATION_ERR = <<~END_DART_CONCURRENT.freeze + Unhandled exception: + Concurrent modification during iteration. + #0 main. (file:///path/to/code/dartFile.dart:35:20) + #1 printError (file:///path/to/code/dartFile.dart:61:13) + #2 main (file:///path/to/code/dartFile.dart:35:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_CONCURRENT + + DART_OOM_ERR = <<~END_DART_OOM.freeze + Unhandled exception: + Out of Memory + #0 main. (file:///path/to/code/dartFile.dart:34:20) + #1 printError (file:///path/to/code/dartFile.dart:61:13) + #2 main (file:///path/to/code/dartFile.dart:34:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_OOM + + DART_STACK_OVERFLOW_ERR = <<~END_DART_STACK.freeze + Unhandled exception: + Stack Overflow + #0 main. (file:///path/to/code/dartFile.dart:33:20) + #1 printError (file:///path/to/code/dartFile.dart:61:13) + #2 main (file:///path/to/code/dartFile.dart:33:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_STACK + + DART_FALLTHROUGH_ERR = <<~END_DART_FALLTHROUGH.freeze + Unhandled exception: + 'null': Switch case fall-through at line null. + #0 main. (file:///path/to/code/dartFile.dart:39:20) + #1 printError (file:///path/to/code/dartFile.dart:51:13) + #2 main (file:///path/to/code/dartFile.dart:39:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_FALLTHROUGH + + DART_TYPE_ERR = <<~END_DART_TYPE.freeze + Unhandled exception: + 'file:///path/to/code/dartFile.dart': malformed type: line 7 pos 24: cannot resolve class 'NoType' from '::' + printError( () { new NoType(); } ); + ^ + + + #0 _TypeError._throwNew (dart:core-patch/errors_patch.dart:82) + #1 main. (file:///path/to/code/dartFile.dart:7:24) + #2 printError (file:///path/to/code/dartFile.dart:36:13) + #3 main (file:///path/to/code/dartFile.dart:7:3) + #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_TYPE + + DART_FORMAT_ERR = <<~END_DART_FORMAT.freeze + Unhandled exception: + FormatException: format exception + #0 main. (file:///path/to/code/dartFile.dart:25:20) + #1 printError (file:///path/to/code/dartFile.dart:42:13) + #2 main (file:///path/to/code/dartFile.dart:25:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_FORMAT + + DART_FORMAT_WITH_CODE_ERR = <<~END_DART_FORMAT_CODE.freeze + Unhandled exception: + FormatException: Invalid base64 data (at line 3, character 8) + this is not valid + ^ + + #0 main. (file:///path/to/code/dartFile.dart:24:20) + #1 printError (file:///path/to/code/dartFile.dart:42:13) + #2 main (file:///path/to/code/dartFile.dart:24:3) + #3 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_FORMAT_CODE + + DART_NO_METHOD_ERR = <<~END_DART_NO_METHOD.freeze + Unhandled exception: + NoSuchMethodError: No constructor 'TypeError' with matching arguments declared in class 'TypeError'. + Receiver: Type: class 'TypeError' + Tried calling: new TypeError("Invalid base64 data", "invalid", 36) + Found: new TypeError() + #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:196) + #1 main. (file:///path/to/code/dartFile.dart:8:39) + #2 printError (file:///path/to/code/dartFile.dart:36:13) + #3 main (file:///path/to/code/dartFile.dart:8:3) + #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_NO_METHOD + + DART_NO_METHOD_GLOBAL_ERR = <<~END_DART_NO_GLOBAL.freeze + Unhandled exception: + NoSuchMethodError: No top-level method 'noMethod' declared. + Receiver: top-level + Tried calling: noMethod() + #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:196) + #1 main. (file:///path/to/code/dartFile.dart:10:20) + #2 printError (file:///path/to/code/dartFile.dart:36:13) + #3 main (file:///path/to/code/dartFile.dart:10:3) + #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:265) + #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151) + END_DART_NO_GLOBAL + + ARBITRARY_TEXT = <<~END_ARBITRARY.freeze + This arbitrary text. + It sounds tympanic: a word which means like a drum. + + I am glad it contains no exception. + END_ARBITRARY def check_multiline(detector, expected_first, expected_last, multiline) lines = multiline.lines @@ -659,7 +637,6 @@ def test_go check_exception(GO_ON_GAE_EXC, false) check_exception(GO_SIGNAL_EXC, false) check_exception(GO_HTTP, false) - check_exception(GO_RECOVERED, false) end def test_ruby diff --git a/test/plugin/test_out_detect_exceptions.rb b/test/plugin/test_out_detect_exceptions.rb index b9c627d..17e5c16 100644 --- a/test/plugin/test_out_detect_exceptions.rb +++ b/test/plugin/test_out_detect_exceptions.rb @@ -22,9 +22,9 @@ def setup Fluent::Test.setup end - CONFIG = <' -END + JAVA_EXC = <<~END_JAVA.freeze + SomeException: foo + at bar + Caused by: org.AnotherException + at bar2 + at bar3 + END_JAVA + + PHP_EXC = <<~END_PHP.freeze + exception 'Exception' with message 'Custom exception' in /home/joe/work/test-php/test.php:5 + Stack trace: + #0 /home/joe/work/test-php/test.php(9): func1() + #1 /home/joe/work/test-php/test.php(13): func2() + #2 {main} + END_PHP + + PYTHON_EXC = <<~END_PYTHON.freeze + Traceback (most recent call last): + File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__ + rv = self.handle_exception(request, response, e) + Exception: ('spam', 'eggs') + END_PYTHON + + RUBY_EXC = <<~END_RUBY.freeze + examble.rb:18:in `thrower': An error has occurred. (RuntimeError) + from examble.rb:14:in `caller' + from examble.rb:10:in `helper' + from examble.rb:6:in `writer' + from examble.rb:2:in `runner' + from examble.rb:21:in `
' + END_RUBY def create_driver(conf = CONFIG, tag = DEFAULT_TAG) d = Fluent::Test::OutputTestDriver.new(Fluent::DetectExceptionsOutput, tag) @@ -76,22 +76,22 @@ def log_entry(message, count, stream) log_entry end - def feed_lines_without_line_breaks(driver, t, *messages, stream: nil) + def feed_lines_without_line_breaks(driver, timestamp, *messages, stream: nil) count = 0 messages.each do |m| m.each_line do |line| line.delete!("\n") - driver.emit(log_entry(line, count, stream), t + count) + driver.emit(log_entry(line, count, stream), timestamp + count) count += 1 end end end - def feed_lines(driver, t, *messages, stream: nil) + def feed_lines(driver, timestamp, *messages, stream: nil) count = 0 messages.each do |m| m.each_line do |line| - driver.emit(log_entry(line, count, stream), t + count) + driver.emit(log_entry(line, count, stream), timestamp + count) count += 1 end end @@ -104,11 +104,11 @@ def run_driver(driver, *messages) end end - def make_logs(t, *messages, stream: nil) + def make_logs(timestamp, *messages, stream: nil) count = 0 logs = [] messages.each do |m| - logs << [t + count, log_entry(m, count, stream)] + logs << [timestamp + count, log_entry(m, count, stream)] count += m.lines.count end logs @@ -148,7 +148,7 @@ def test_ignore_nested_exceptions single_line_exception = exception.gsub("\n", '\\n') # There is a nested exception within the body, we should ignore those! - json_line_with_exception = { + json_with_exception = { 'timestamp' => { 'nanos' => 998_152_494, 'seconds' => 1_496_420_064 @@ -156,8 +156,9 @@ def test_ignore_nested_exceptions 'message' => single_line_exception, 'thread' => 139_658_267_147_048, 'severity' => 'ERROR' - }.to_json + "\n" - json_line_without_exception = { + } + json_line_with_exception = "#{json_with_exception.to_json}\n" + json_without_exception = { 'timestamp' => { 'nanos' => 5_990_266, 'seconds' => 1_496_420_065 @@ -165,7 +166,8 @@ def test_ignore_nested_exceptions 'message' => 'next line', 'thread' => 139_658_267_147_048, 'severity' => 'INFO' - }.to_json + "\n" + } + json_line_without_exception = "#{json_without_exception.to_json}\n" router_mock = flexmock('router') @@ -245,7 +247,7 @@ def test_do_not_split_exception_after_pause feed_lines(d, t2, " at x\n at y\n") d.instance.before_shutdown end - assert_equal(make_logs(t1, JAVA_EXC + " at x\n at y\n"), d.events) + assert_equal(make_logs(t1, "#{JAVA_EXC} at x\n at y\n"), d.events) end def test_remove_tag_prefix_is_required @@ -317,9 +319,9 @@ def test_flush_after_max_lines # For the following Java stack trace, the two lines of the first exception # are buffered and combined. So are the first two lines of the second # exception. Then the rest is logged line-by-line. - expected = [PYTHON_EXC.lines[0..1].join] + PYTHON_EXC.lines[2..-1] + \ + expected = [PYTHON_EXC.lines[0..1].join] + PYTHON_EXC.lines[2..] + \ [JAVA_EXC.lines[0..1].join] + [JAVA_EXC.lines[2..3].join] + \ - JAVA_EXC.lines[4..-1] + JAVA_EXC.lines[4..] assert_equal(make_logs(t, *expected), d.events) end @@ -332,9 +334,9 @@ def test_separate_streams d.run do feed_lines(d, t, JAVA_EXC.lines[0], stream: 'java') feed_lines(d, t, PYTHON_EXC.lines[0..1].join, stream: 'python') - feed_lines(d, t, JAVA_EXC.lines[1..-1].join, stream: 'java') + feed_lines(d, t, JAVA_EXC.lines[1..].join, stream: 'java') feed_lines(d, t, JAVA_EXC, stream: 'java') - feed_lines(d, t, PYTHON_EXC.lines[2..-1].join, stream: 'python') + feed_lines(d, t, PYTHON_EXC.lines[2..].join, stream: 'python') feed_lines(d, t, 'something else', stream: 'java') end # Expected: the Python and the Java exceptions are handled separately