org.jruby.exceptions.RaiseException: (SyntaxError) <script>:2: invalid multibyte char (UTF-8)

GitHub | diegoscl | 2 months ago
  1. 0

    Error after macOS Sierra upgrade

    GitHub | 2 months ago | diegoscl
    org.jruby.exceptions.RaiseException: (SyntaxError) <script>:2: invalid multibyte char (UTF-8)
  2. 0

    In my setup I use logstash to handle syslog input. One of my network appliances (mail-relay) sends logmessages with "strange" or may be wrong encoding, which leads to crashing logstash. I think, the above message is not validly encoded. In my opinion, if logstash is used in mission-critical environments, it should be tollerant to such "wrongly encoded" events. I checked with the file output and the redis output. Error Message (Redis): {noformat} Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (GeneratorError) source sequence is illegal/malformed utf-8 at json.ext.GeneratorMethods$RbHash.to_json(json/ext/GeneratorMethods.java:71) at LogStash::Event.to_json(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/event.rb:169) at LogStash::Outputs::Redis.receive(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/outputs/redis.rb:150) at RUBY.initialize((eval):17) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:255) at LogStash::Pipeline.output(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:247) at RUBY.outputworker(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:212) at RUBY.start_outputs(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:140) {noformat} Error Message (File): {noformat} Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (GeneratorError) source sequence is illegal/malformed utf-8 at json.ext.GeneratorMethods$RbHash.to_json(json/ext/GeneratorMethods.java:71) at LogStash::Event.to_json(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/event.rb:169) at LogStash::Outputs::File.receive(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/outputs/file.rb:68) at RUBY.initialize((eval):28) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:255) at LogStash::Pipeline.output(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:247) at RUBY.outputworker(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:212) at RUBY.start_outputs(file:/opt/logstash/logstash-1.2.1-flatjar.jar!/logstash/pipeline.rb:140) {noformat} I recorded the corrupted messages with tcpdump and was able to reproduce the exception. Steps to reproduce: 1. Start logstash with following config-file: {noformat} input { udp { port => 514 type => syslog } } output { file { path => "/tmp/out.log" flush_interval => 0 } } {noformat} 2. Send correct message to syslog {noformat} echo -en "syslog correct" | nc -u localhost 514 {noformat} (Check /tmp/out.log for the message 3. Send corrupted message to syslog {noformat} echo -en "syslog corrupted: \xfc" | nc -u localhost 514 {noformat} (Nothing is written to /tmp/out.log, logstash crashes with above error-message) I double-checked with an alternative logstash configuration with charset "ASCII-8BIT". In this case the logline wasn't written to /tmp/out.log but logstash at least kept working normaly. Alternative logstash config: {noformat} input { udp { port => 515 type => syslog codec => plain { charset => "ASCII-8BIT" } } } output { file { path => "/tmp/fortimail-log/out.log" flush_interval => 0 } } {noformat}

    JIRA | 3 years ago | Lucas Bremgartner
    org.jruby.exceptions.RaiseException: (GeneratorError) source sequence is illegal/malformed utf-8
  3. 0

    GitHub comment 1#13351623

    GitHub | 4 years ago | LightGuard
    javax.script.ScriptException: org.jruby.embed.ParseFailedException: (SyntaxError) <script>:6: syntax error, unexpected ',' Asciidoctor.render_file({path, :in_place => true, :safe => Asciidoctor::SafeMode::UNSAFE, ^
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 1#13351623

    GitHub | 4 years ago | LightGuard
    javax.script.ScriptException: org.jruby.embed.ParseFailedException: (SyntaxError) <script>:6: syntax error, unexpected ',' Asciidoctor.render_file({path, :in_place => true, :safe => Asciidoctor::SafeMode::UNSAFE, ^
  6. 0

    GitHub comment 1#13347384

    GitHub | 4 years ago | dobermai
    javax.script.ScriptException: org.jruby.embed.ParseFailedException: (SyntaxError) <script>:6: syntax error, unexpected ',' Asciidoctor.render_file({path, :in_place => true, :safe => Asciidoctor::SafeMode::UNSAFE, ^

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.jruby.exceptions.RaiseException

      (SyntaxError) <script>:2: invalid multibyte char (UTF-8)

      at s3.website.Ruby$.rubyRegexMatches()
    2. s3.website
      package$S3KeyRegex.matches
      1. s3.website.Ruby$.rubyRegexMatches(Ruby.scala:7)
      2. s3.website.package$S3KeyRegex.matches(package.scala:60)
      2 frames
    3. s3.website.model
      Files$$anonfun$7$$anonfun$apply$9.apply
      1. s3.website.model.Files$$anonfun$7$$anonfun$apply$9.apply(push.scala:164)
      2. s3.website.model.Files$$anonfun$7$$anonfun$apply$9.apply(push.scala:164)
      2 frames
    4. Scala
      List.exists
      1. scala.collection.LinearSeqOptimized$class.exists(LinearSeqOptimized.scala:93)
      2. scala.collection.immutable.List.exists(List.scala:84)
      2 frames
    5. s3.website.model
      Files$$anonfun$7.apply
      1. s3.website.model.Files$$anonfun$7.apply(push.scala:164)
      2. s3.website.model.Files$$anonfun$7.apply(push.scala:164)
      2 frames
    6. Scala
      Option.exists
      1. scala.Option.exists(Option.scala:240)
      1 frame
    7. s3.website.model
      Files$$anonfun$listSiteFiles$2.apply
      1. s3.website.model.Files$.s3$website$model$Files$$excludeFromUpload$1(push.scala:163)
      2. s3.website.model.Files$$anonfun$listSiteFiles$2.apply(push.scala:173)
      3. s3.website.model.Files$$anonfun$listSiteFiles$2.apply(push.scala:173)
      3 frames
    8. Scala
      AbstractTraversable.filterNot
      1. scala.collection.TraversableLike$$anonfun$filterImpl$1.apply(TraversableLike.scala:259)
      2. scala.collection.mutable.ArraySeq.foreach(ArraySeq.scala:74)
      3. scala.collection.TraversableLike$class.filterImpl(TraversableLike.scala:258)
      4. scala.collection.TraversableLike$class.filterNot(TraversableLike.scala:278)
      5. scala.collection.AbstractTraversable.filterNot(Traversable.scala:104)
      5 frames
    9. s3.website.model
      Files$.listSiteFiles
      1. s3.website.model.Files$.listSiteFiles(push.scala:173)
      1 frame
    10. s3.website
      Push$$anonfun$7$$anonfun$apply$8.apply
      1. s3.website.UploadHelper$.resolveDeletes(UploadHelper.scala:56)
      2. s3.website.Push$$anonfun$7$$anonfun$apply$8.apply(Push.scala:98)
      3. s3.website.Push$$anonfun$7$$anonfun$apply$8.apply(Push.scala:98)
      3 frames
    11. Scala
      Either.fold
      1. scala.util.Either.fold(Either.scala:99)
      1 frame
    12. s3.website
      Push$$anonfun$7.apply
      1. s3.website.Push$$anonfun$7.apply(Push.scala:96)
      2. s3.website.Push$$anonfun$7.apply(Push.scala:95)
      2 frames
    13. Scala
      CallbackRunnable.run
      1. scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
      2. scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:249)
      3. scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
      3 frames