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
How to cancel a SPDYExecutor stream? #554
Comments
I have found that as soon as stdin is closed it will return. Though I also found this to be inconsistent and just switched to GetLogs and updated my containers that used to expect stdin to read from an env var that I pass into the POD when starting it. https://gitlab.com/f5-pwe/kog/blob/master/executor.k8s.go#L197 |
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. |
@rberrelleza do you find the solution to this? |
no, the proposed solution didn't work for me. I ended up launching the connection on a goroutine so it wouldn't block the rest, and just time it out if needed. |
You can set |
I send CTRL-D(0x04) to close it. |
write message with ctrl-d or 0x04? |
How to with ctrl-d or 0x04? |
exit command from frontend,but it cant resolve the situation like vpn disconnection unexpectly.you can restore pid locally and send kill command next time the user log in the same pod |
请问下。我用了client-go 的新版本,提供了 StreamWithContext函数,可以通过监听前端websocket关闭,来同时控制关闭这个context。这样 Stream流倒是关闭了, 但是我发现pod里面的sh进程还存在。 不知道怎么发送 ctrl-d or 0x04,有例子吗。 |
参考这个pr kubesphere/kubesphere#5024 在关闭时向流中写入0x04,但是还是有上面说的问题,如果网络异常,无法发送该信号到容器中;或者在容器中sh又执行bash,那0x04只会关闭最外层的shell,还是会导致有sh进程泄露。 |
有其他好的实现吗,确实还是会sh进程泄露。不知道是不是0x04没发送成的问题 |
如果只有一层shell进程,网络正常的话,0x04是好用的,我已经在我们的环境上测试完成了。 |
是直接在这个函数里面写吗 |
是的,看pr的terminal.go文件修改内容呀,在需要的退出位置 copy(p, '\u0004') |
I'm executing a long-running command on a pod with the following code:
In this implementation,
exec.Stream
won't return until the command finishes.How can I cancel the call to
Executor.Stream
? (e.g. to react to a cancellation context, or to initiate a shutdown sequence). I searched in the docs and the code base but couldn't figure out a way to pass a context, a cancel function or something similar.The text was updated successfully, but these errors were encountered: