Kouhei Sutou
null+****@clear*****
Mon Oct 3 16:34:29 JST 2016
Kouhei Sutou 2016-10-03 16:34:29 +0900 (Mon, 03 Oct 2016) New Revision: 24d70bf751ef0566e7da49826cdf76382647b44a https://github.com/groonga/fluent-plugin-groonga/commit/24d70bf751ef0566e7da49826cdf76382647b44a Message: Ignore invalid MessagePack Modified files: lib/fluent/plugin/in_groonga.rb Modified: lib/fluent/plugin/in_groonga.rb (+9 -4) =================================================================== --- lib/fluent/plugin/in_groonga.rb 2016-10-03 16:27:04 +0900 (89f02b5) +++ lib/fluent/plugin/in_groonga.rb 2016-10-03 16:34:29 +0900 (fea3e0a) @@ -383,6 +383,7 @@ module Fluent def on_message_complete return if****@parse*****_code == 100 + response = nil case @content_type when /\Aapplication\/json\z/i begin @@ -392,14 +393,18 @@ module Fluent "failed to parse response JSON:", :error => "#{$!.class}: #{$!}", :json => @body) - response = nil end when /\Aapplication\/x-msgpack\z/i - response = MessagePack.unpack(@body) + begin + response = MessagePack.unpack(@body) + rescue MessagePack::UnpackError, EOFError + $log.warn("[input][groonga][response][warn] " + + "failed to parse response MessagePack", + :error => "#{$!.class}: #{$!}", + :msgpack => @body) + end when /\Atext\/x-groonga-command-list\z/i response = @body - else - response = nil end @handler.on_response_complete(response) end -------------- next part -------------- HTML����������������������������...Download