-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timezone info decode error: Task failed 'script_runner.tasks.run' -> UnicodeDecodeError #112
Comments
wangyanbn
added a commit
to wangyanbn/cloudify-plugins-common
that referenced
this issue
May 9, 2016
ref cloudify-cosmo/cloudify-agent#112: In agent script_runner.tasks.run ,if an agent locale is not of ascii codeset (such as "Chinese (Simplified)_People's Republic of China", '936'), the timezone info is not utf-8 encoded.This will cause exception in logging (amqp_client.publish_message in cloudify/logs.py) , which will cause exception in local logging with json.dumps. This method can fix it: when celery app starts, set default locale, and when getting timezone info in logging ,use the correct codeset from locale. Here is the Traceback: [2016-05-09 10:08:15,540: ERROR/MainProcess] Task script_runner.tasks.run[84982083-9ef8-4879-add3-da53d623330a] raised unexpected: UnicodeDecodeError('utf8', '2016-05-09 10:08:15.481\xd6\xd0\xb9\xfa\xb1\xea\xd7\xbc\xca\xb1\xbc\xe4', 23, 24, 'invalid continuation byte') Traceback (most recent call last): File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\celery\app\trace.py", line 240, in trace_task R = retval = fun(args, *kwargs) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\celery\app\trace.py", line 438, in protected_call return self.run(args, *kwargs) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\decorators.py", line 126, in wrapper ctx.task_name, exc_info=True) File "C:\Python27.11\Lib\logging__init__.py", line 1185, in error self.log(ERROR, msg, args, **kwargs) File "C:\Python27.11\Lib\logging__init_.py", line 1278, in log self.handle(record) File "C:\Python27.11\Lib\logging__init_.py", line 1288, in handle self.callHandlers(record) File "C:\Python27.11\Lib\logging__init__.py", line 1328, in callHandlers hdlr.handle(record) File "C:\Python27.11\Lib\logging__init__.py", line 751, in handle self.emit(record) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 119, in emit self.out_func(log) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 342, in amqp_log_out publish_message(log, 'log', logging.getLogger('cloudify_logs')) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 322, in wrapper func(client, args, *kwargs) File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 379, in publish_message 'message={1}, log={2}]' File "C:\Python27.11\Lib\json__init.py", line 244, in dumps return _default_encoder.encode(obj) File "C:\Python27.11\Lib\json\encoder.py", line 207, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Python27.11\Lib\json\encoder.py", line 270, in iterencode return _iterencode(o, 0) UnicodeDecodeError: 'utf8' codec can't decode byte 0xd6 in position 23: invalid continuation byte
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In agent script_runner.tasks.run ,if an agent locale is not of ascii codeset (such as "Chinese (Simplified)_People's Republic of China", '936'), the timezone info is not utf-8 encoded.This will cause exception in logging (amqp_client.publish_message in cloudify/logs.py) , which will cause exception in local logging with json.dumps.
This method can fix it: when celery app starts, set default locale, and when getting timezone info in logging ,use the correct codeset from locale.
Here is the Traceback:
[2016-05-09 10:08:15,540: ERROR/MainProcess] Task script_runner.tasks.run[84982083-9ef8-4879-add3-da53d623330a] raised unexpected: UnicodeDecodeError('utf8', '2016-05-09 10:08:15.481\xd6\xd0\xb9\xfa\xb1\xea\xd7\xbc\xca\xb1\xbc\xe4', 23, 24, 'invalid continuation byte')
Traceback (most recent call last):
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\celery\app\trace.py", line 240, in trace_task
R = retval = fun(args, *kwargs)
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\celery\app\trace.py", line 438, in protected_call
return self.run(args, *kwargs)
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\decorators.py", line 126, in wrapper
ctx.task_name, exc_info=True)
File "C:\Python27.11\Lib\logging__init.py", line 1185, in error
self.log(ERROR, msg, args, **kwargs)
File "C:\Python27.11\Lib\logging__init.py", line 1278, in log
self.handle(record)
File "C:\Python27.11\Lib\logging__init.py", line 1288, in handle
self.callHandlers(record)
File "C:\Python27.11\Lib\logging__init__.py", line 1328, in callHandlers
hdlr.handle(record)
File "C:\Python27.11\Lib\logging__init__.py", line 751, in handle
self.emit(record)
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 119, in emit
self.out_func(log)
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 342, in amqp_log_out
_publish_message(log, 'log', logging.getLogger('cloudify_logs'))
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 322, in wrapper
func(client, _args, *kwargs)
File "c:\users\sys\test_windows_host_2d6ed\env\lib\site-packages\cloudify\logs.py", line 379, in publish_message
'message={1}, log={2}]'
File "C:\Python27.11\Lib\json__init.py", line 244, in dumps
return _default_encoder.encode(obj)
File "C:\Python27.11\Lib\json\encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python27.11\Lib\json\encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd6 in position 23: invalid continuation byte
The text was updated successfully, but these errors were encountered: