Closed huguesb closed 2 years ago
Hi @huguesb, thanks for giving pdb-attach a try.
I don't use kubernetes so you'll have to bear with me as there may be something kubernetes does under the hood that I don't know about.
I have never used the interact
command in pdb-attach so that's something I can investigate outside of kubernetes. If I can't find an issue with interact
outside of kubernetes then I'll probably need a simple reproducible example from you. In the meantime just hold tight as I look into this.
Ok, I was able to reproduce so it's not due to kubernetes. The command just hangs in the pdb cli and the interactive shell starts up on the stdin/stdout of the original process. In your case, I assume there is no stdin/stdout or it's not in an interactive shell for your running process so it just throws an error and exits. I'll hopefully have a fix for you soon.
Thank you for the quick follow-up. I was able to use the !
operator to execute statements one at a time so the lack of interact
is less of an issue than I first thought, although it would still be nice to fix, or alternatively intercept the command and explain that it is not supported.
I've been working on a fix. It turns out to be more involved than I first thought but I believe there's still a feasible solution. Should have this resolved by the end of this weekend.
A quick update. I'm very close to having this fixed, but will not have it done by the end of this weekend. It has turned out to be a non-trivial rewrite of a lot of the underlying IPC. At this point it can start the interactive console and send commands, but cannot write the output to screen or exit back to the pdb console correctly. It's close and I'll work on it more this week as time permits.
Fixed in 751c8dc7ceeae11fd3bd179346ff4119afdd89db.
I have a python process running in k8s.
I am able to
kubectl exec
into the appropriate pod, and usepdb-attach
to connect to it. However theinteract
command doesn't drop me in an interactive shell in the calling process. Instead it leaves me in the pdb cli, and shows some logs in the running process about starting and then promptly exiting an interactive session.NB: I also tried
kubectl attach
to the running container to catch the interactive session there, but that didn't work either.Has anyone had success using an interactive shell via
pdb-attach
? If yes, any suggestions on what I could try to get it work in my case? If not, any hope it might be made to work at some point?