-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
When EAP 7.1 image running with the locale like ja_JP which outputs non-ascii characters, HealthCheckProbe in readinessProve / livenessProbe fails like the following example:
sh-4.2$ /bin/bash -c /opt/eap/bin/readinessProbe.sh { "probe.eap.dmr.EapProbe": { "probe.eap.dmr.ServerStatusTest": "running", "probe.eap.dmr.DeploymentTest": { "example.war": "OK" }, "probe.eap.dmr.BootErrorsTest": "No boot errors" }, "probe.eap.dmr.HealthCheckProbe": { "probe.eap.dmr.HealthCheckTest": "Exception executing test: 'ascii' codec can't encode characters in position 13-16: ordinal not in range(128)" } }
HealthCheckTest checks the existence of "microprofile-health-smallrye" subsystem and check the healthiness from it:
163 class HealthCheckTest(Test): 164 """ 165 Checks the state of the Health Check subsystem, if installed. 166 We use a composite with a first step that does a simple read-resource 167 and a second step that reads the health check status. 168 A failure in the first step means the subsystem is not present and any 169 failure in the second step should be ignored as meaningless. 170 """ 171 172 def __init__(self): 173 super(HealthCheckTest, self).__init__( 174 { 175 "operation": "composite", 176 "address": [], 177 "steps": [ 178 { 179 "operation": "read-resource", 180 "address": { 181 "subsystem": "microprofile-health-smallrye" 182 }, 183 "recursive" : False 184 }, 185 { 186 "operation": "check", 187 "address": { 188 "subsystem": "microprofile-health-smallrye" 189 } 190 } 191 ] 192 } 193 ) : 211 if results.get("failure-description") and re.compile("JBAS014883|WFLYCTL0030").search(str(results.get("failure-description"))): 212 return (Status.READY, "Health Check not configured") :
EAP 7.1 does not have "microprofile-health-smallrye" subsystem, so it returns "failure-description". However, when EAP 7.1 starts with "LANG=ja_JP.utf8" (or LANG=zn_CN.utf8), it returns non-ascii characters in "failure-description". For example:
- With the locale en_US.utf8:
{ "outcome" : "failed", "result" : { "step-1" : null, "step-2" : null }, "failure-description" : "WFLYCTL0030: No resource definition is registered for address [(\"subsystem\" => \"microprofile-health-smallrye\")]", "rolled-back" : true }
- With the locale ja_JP.utf8 (Japanese):
{ "outcome" : "failed", "result" : { "step-1" : null, "step-2" : null }, "failure-description" : "WFLYCTL0030: アドレス [(\"subsystem\" => \"microprofile-health-smallrye\")] に対して登録されたリソース定義はありません", "rolled-back" : true }
- With the locale zn_CN.utf8 (Chinese):
{ "outcome" : "failed", "result" : { "step-1" : null, "step-2" : null }, "failure-description" : "WFLYCTL0030: 在地址 [(\"subsystem\" => \"microprofile-health-smallrye\")] 上没有注册资源定义", "rolled-back" : true }
I would suggest using "encode('utf-8')" instead of "str" in dmr.py. See also https://docs.python.org/2.7/howto/unicode.html#the-unicode-type for details.
Additional comment:
$ ipython In [1]: u1 = u'WFLYCTL0030: No resource definition is registered for address [("subsystem" => "microprofile-health-smallrye")]' In [2]: str(u1) Out[2]: 'WFLYCTL0030: No resource definition is registered for address [("subsystem" => "microprofile-health-smallrye")]' In [3]: u2 = u'WFLYCTL0030: アドレス [("subsystem" => "microprofile-health-smallrye")] に対して登録されたリソース定義はありません' In [4]: str(u2) --------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-4-399d8867784e> in <module>() ----> 1 str(u2) UnicodeEncodeError: 'ascii' codec can't encode characters in position 13-16: ordinal not in range(128) In [5]: u2.encode('utf-8') Out[5]: 'WFLYCTL0030: \xe3\x82\xa2\xe3\x83\x89\xe3\x83\xac\xe3\x82\xb9 [("subsystem" => "microprofile-health-smallrye")] \xe3\x81\xab\xe5\xaf\xbe\xe3\x81\x97\xe3\x81\xa6\xe7\x99\xbb\xe9\x8c\xb2\xe3\x81\x95\xe3\x82\x8c\xe3\x81\x9f\xe3\x83\xaa\xe3\x82\xbd\xe3\x83\xbc\xe3\x82\xb9\xe5\xae\x9a\xe7\xbe\xa9\xe3\x81\xaf\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93' In [6]: type(u2.encode('utf-8')) Out[6]: str In [7]: u3 = u'WFLYCTL0030: 在地址 [(\"subsystem\" => \"microprofile-health-smallrye\")] 上没有注册资源定义' In [8]: str(u3) --------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-8-1be681bc93b8> in <module>() ----> 1 str(u3) UnicodeEncodeError: 'ascii' codec can't encode characters in position 13-15: ordinal not in range(128) In [9]: u3.encode('utf-8') Out[9]: 'WFLYCTL0030: \xe5\x9c\xa8\xe5\x9c\xb0\xe5\x9d\x80 [("subsystem" => "microprofile-health-smallrye")] \xe4\xb8\x8a\xe6\xb2\xa1\xe6\x9c\x89\xe6\xb3\xa8\xe5\x86\x8c\xe8\xb5\x84\xe6\xba\x90\xe5\xae\x9a\xe4\xb9\x89' In [10]: type(u3.encode('utf-8')) Out[10]: str
- is cloned by
-
JBEAP-23302 [GSS](7.4.z) CLOUD-3172 - readinessProve / livenessProbe fails with "'ascii' codec can't encode characters" when the locale supports non-ascii characters
-
- Closed
-