+++ This bug was initially created as a clone of Bug #1191681 +++ Description of problem: Watchman's jboss plugin fails with "invalid byte sequence in UTF-8" if a jboss log contains, ISO-8859-1 bytes which are not valid UTF-8 (such as \xe9). Version-Release number of selected component (if applicable): openshift-origin-node-util-1.33.4-1.el6oso.noarch How reproducible: Always Steps to Reproduce: 1. create a jbossews app 2. echo -e '\xe9' >> ~/app-root/logs/jbossews.log Actual results: watchman will event print something like this to /var/log/messages: Feb 9 17:41:38 ex-std-nodeXXX watchman[217144]: Unhandled exception (invalid byte sequence in UTF-8) from Watchman plugin #<JbossPlugin:0x00000002c277a0>: invalid byte sequence in UTF-8 Expected results: watchman should ignore invalid characters in the log file. Additional info: This has been dealt with two different ways in the past. It was first fixed in https://bugzilla.redhat.com/show_bug.cgi?id=1023576 by treating the file as binary (opening it with 'rb'). When the code was refactored and moved into origin-server, the 'b' was lost, and the bug came up again as https://bugzilla.redhat.com/show_bug.cgi?id=1059804 This time, it was fixed by opening the file with "r:utf-8", but that only works as long as all of the byte sequences are valid utf-8, which we cannot control. I'd suggest either going back to "rb", or doing something like: File.open(log, 'r:utf-8').each_line do |event| next unless event.valid_encoding? && event =~ / java.lang.OutOfMemoryError/ ... In my tests, this is about 15-20% more expensive than grep, but it works. --- Additional comment from Dan Mace on 2015-02-12 12:53:34 EST --- https://github.com/openshift/origin-server/pull/6073 --- Additional comment from Meng Bo on 2015-02-13 02:45:18 EST --- Checked on devenv_5430, after insert the invalid ISO-8859-1 string "\xe9" to the jboss log, the watchman will not report unhandled exception and still works well on the existing features. Move bug to verified.
Verified and pass on puddle-2-2-2015-03-16 1) Create jbossews and jbosseap6 application add utf-8 code & java.lang.OutOfMemoryError/ in jbossews.log and jbosseap.log For example: 2015/03/17 14:11:14,582 INFO é 2015/03/17 14:11:14,582 INFO ¿¿¿¿¿ 2015/03/17 14:11:14,582 INFO java.lang.OutOfMemoryError 2)check /var/log/message. jbosseap and jbossews were restarted and no exception Mar 17 14:05:36 node1 watchman[1447]: Gears: 5, Memory: 41112, Plugin: all, Symbols: 10674, Objects: 182281 Mar 17 14:05:56 node1 watchman[1447]: Gears: 5, Memory: 41112, Plugin: all, Symbols: 10674, Objects: 182281 Mar 17 14:06:37 node1 watchman[1447]: watchman restarted user 5507ac314add71c6dc0000a7: application jbosseap6 (retries: 0) Mar 17 14:06:37 node1 watchman[1447]: Gears: 5, Memory: 41116, Plugin: all, Symbols: 10676, Objects: 182281 Mar 17 14:06:57 node1 watchman[1447]: gear 5507ac314add71c6dc0000a7 (re)started under retry_delay (1/480) Mar 17 14:07:06 node1 watchman[1447]: watchman restarted user 5507c11f4add7185960000b2: application jbossews (retries: 0)
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0779.html