-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
when use exec api tail xxx.log error "'utf-8' codec can't decode bytes" #717
Comments
I get the same error when execute vim command.
error message:
I print the data in "kubernetes/stream/ws_client.py", line 180, and the last one raise UnicodeDecodeError
version |
你解决问题了吗?我这样修改,我的问题解决了。仅限python3的,python2.7依然报错。
|
你是修改源码了是吧 |
是的 |
好的,我也试试,测看看结果 |
|
你使用哪个 websocket 的包。 |
我用的就是dwebsocket |
麻烦请教,django如果使用channels怎么实现web terminal呢 |
I ran into the same issue for the port-forward api. The proposed fix worked for me. Any chance to get it merged? Giorgio |
The above patch also worked on my end with Python 3.7 |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
When I'am exec pod use tail -200f xxx.log.The following error is often reported
Exception in thread Thread-426:
Traceback (most recent call last):
File "/data/pyenv/versions/3.7.0/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/data/SeaOPS/Base/api/views_file/kubernetes.py", line 591, in run
requests[fileno] = self.chan.read_stdout()
File "/data/pyenv/versions/3.7.0/lib/python3.7/site-packages/kubernetes/stream/ws_client.py", line 122, in read_stdout
return self.read_channel(STDOUT_CHANNEL, timeout=timeout)
File "/data/pyenv/versions/3.7.0/lib/python3.7/site-packages/kubernetes/stream/ws_client.py", line 86, in read_channel
ret = self.peek_channel(channel, timeout)
File "/data/pyenv/versions/3.7.0/lib/python3.7/site-packages/kubernetes/stream/ws_client.py", line 78, in peek_channel
self.update(timeout=timeout)
File "/data/pyenv/versions/3.7.0/lib/python3.7/site-packages/kubernetes/stream/ws_client.py", line 182, in update
data = data.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 4095-4096: unexpected end of data
The utf-8 decode error is currently seen on the source side
Here's some of my code
..........
while self.chan.is_open():
events = self.epoll.poll()
# print("events")
if not self.chan.is_open():
logger.info('container stream connect is closed')
self.websocket.send(bytes("container stream connect is closed", 'utf-8'))
self.websocket.close()
for fileno, event in events:
# print("adsfadsaf:", fileno, event)
if event & select.EPOLLIN:
requests[fileno] = self.chan.read_stdout()
# try:
# requests[fileno] = self.chan.read_stdout()
# except Exception as ee:
# logger.info(str(ee))
self.websocket.send(bytes(requests[fileno], 'utf-8'))
elif event & select.EPOLLHUP:
# print('------------EPOLLHUP-----------')
# 注销对此socket连接的关注
self.epoll.unregister(fileno)
# 关闭socket连
self.websocket.close()
............
Can anyone help me see why that is?Is it a Bug or something else?
The text was updated successfully, but these errors were encountered: