You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Philippe Kernevez (JIRA)" <ji...@apache.org> on 2015/01/29 13:30:34 UTC
[jira] [Created] (AMBARI-9396) Can't have the original error a
Oozie service check when the error contain non utf-8 chars
Philippe Kernevez created AMBARI-9396:
-----------------------------------------
Summary: Can't have the original error a Oozie service check when the error contain non utf-8 chars
Key: AMBARI-9396
URL: https://issues.apache.org/jira/browse/AMBARI-9396
Project: Ambari
Issue Type: Bug
Components: ambari-server
Affects Versions: 1.7.0
Environment: CentOS + HDP 2.2
Default encoding fr_ch.UTF-8
Reporter: Philippe Kernevez
When I run Oozie service check I had a failure that is due to the logger that can't manage non utf-8 char.
The failure I had :
{code}
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 59, in <module>
OozieServiceCheck().execute()
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 123, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 31, in service_check
oozie_smoke_shell_file( smoke_test_file_name)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 55, in oozie_smoke_shell_file
logoutput = True
File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
self.env.run()
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 149, in run
self.run_action(resource, action)
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 115, in run_action
provider_action()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 237, in action_run
path=self.resource.path)
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 36, in checked_call
return _call(command, logoutput, True, cwd, env, preexec_fn, user, wait_for_finish, timeout, path)
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 101, in _call
err_msg = Logger.get_protected_text(("Execution of '%s' returned %d. %s") % (command, code, out))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)
{code}
When I changed the file shell.py line 101 :
{code}
--- /usr/lib/python2.6/site-packages/resource_management/core/shell.py.back 2015-01-29 11:33:09.576977676 +0100
+++ /usr/lib/python2.6/site-packages/resource_management/core/shell.py 2015-01-29 11:46:41.957279179 +0100
@@ -98,7 +98,7 @@
Logger.info(out)
if throw_on_failure and code:
- err_msg = Logger.get_protected_text(("Execution of '%s' returned %d. %s") % (command, code, out))
+ err_msg = Logger.get_protected_text(("Execution of '%s' returned %d. %s") % (command, code, out.decode('utf-8')))
raise Fail(err_msg)
return code, out
{code}
With that change, I had another error just after :
{code}
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 59, in <module>
OozieServiceCheck().execute()
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 123, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 31, in service_check
oozie_smoke_shell_file( smoke_test_file_name)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 55, in oozie_smoke_shell_file
logoutput = True
File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
self.env.run()
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 149, in run
self.run_action(resource, action)
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 115, in run_action
provider_action()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 243, in action_run
Logger.info("Retrying after %d seconds. Reason: %s" % (self.resource.try_sleep, str(ex)))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 209: ordinal not in range(128)
{code}
Using this patch I can saw my error :
--- providers/system.py.bak 2015-01-29 03:08:43.871997817 -0800
+++ providers/system.py 2015-01-29 04:21:07.522199705 -0800
@@ -240,7 +240,11 @@
if i == self.resource.tries-1: # last try
raise ex
else:
- Logger.info("Retrying after %d seconds. Reason: %s" % (self.resource.try_sleep, str(ex)))
+ print(type(ex))
+ print(type(ex.__repr__()))
+ txt = ex.__repr__().decode('utf-8')
+ print(txt)
+ Logger.info("Retrying after %d seconds. Reason: %s" % (self.resource.try_sleep, txt))
time.sleep(self.resource.try_sleep)
except ExecuteTimeoutException:
err_msg = ("Execution of '%s' was killed due timeout after %d seconds") % (self.resource.command, self.resource.timeout)
Now I saw the error in the output :
{code}
2015-01-29 04:24:11,810 - Error while executing command 'service_check':
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 123, in execute
method(env)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 31, in service_check
oozie_smoke_shell_file( smoke_test_file_name)
File "/var/lib/ambari-agent/cache/stacks/HDP/2.0.6/services/OOZIE/package/scripts/service_check.py", line 55, in oozie_smoke_shell_file
logoutput = True
File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 148, in __init__
self.env.run()
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 149, in run
self.run_action(resource, action)
File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 115, in run_action
provider_action()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py", line 241, in action_run
raise ex
Fail: Execution of '/var/lib/ambari-agent/data/tmp/oozieSmoke2.sh redhat /etc/oozie/conf /usr/hdp/current/oozie-client/bin /etc/hadoop/conf /usr/hdp/current/hadoop-client/bin ambari-qa False' returned 1. dirname: op\xe9rande manquant
Saisissez \xab\xa0dirname --help\xa0\xbb pour plus d'informations.
15/01/29 04:23:27 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 360 minutes, Emptier interval = 0 minutes.
Moved: 'hdfs://sandbox.hortonworks.com:8020/user/ambari-qa/examples' to trash at: hdfs://sandbox.hortonworks.com:8020/user/ambari-qa/.Trash/Current
{code}
The patch attach in https://issues.apache.org/jira/browse/AMBARI-9283 doesn't change any thing.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)