Closed rsrdesarrollo closed 3 years ago
The fix basically ignores PID for watchpids and only uses docker container. If the container is stopped, the program ends. As I told you, I don't know if this could break other things.
Thank you for the report and the PR! I've left a note in the PR and will merge it after you've adjusted it.
I wonder why the pid check fails in WSL2. However, I don't have a test environment yet to track this down, and take the easy way to accept your fix. It sounds like a new bug in Docker because it worked previously.
So, it seems that in watchpidlist you are watching for what you call pid1pid (which I believe is the host PID for guest container PID 1)
Yes, entirely correct.
it seems to work, but probably I'm breaking other things, don't know.
It doesn't break anything, but costs CPU resources (see comment in PR).
A late thought:
Maybe it wasn't the native Linux docker that is executed in your WSL2 setup but your PATH
points to docker.exe
/MobyVM first? That would explain the PID1 issue.
Could you please check and show the output of which docker
in WSL2?
Hi,
The PID thing is because by default, docker creates it's own WSL images to run containers and then (somehow) integrates with other WSLs.
But the actual process is not running on your common WSL (ubuntu in my case) but on the docker-desktop WSL. That's why you can't find the host process.
About which docker
Looks normal to me, but docker might be doing some dark magic (probably with docker sock) to connect one WSL to the other.
But the actual process is not running on your common WSL (ubuntu in my case) but on the docker-desktop WSL. That's why you can't find the host process. docker might be doing some dark magic (probably with docker sock) to connect one WSL to the other.
Thank you for the clarification! This was different in the early days of WSL2; it allowed a native docker without any modification.
I think it wasn't a good design decision of Docker devs to change this. Though, my opinion does not count much here.
FTR, I use Docker on Windows and I don't use the WSL2 integration. I.e., for now, WSL2 is a different optional backend, not the default one.
Hi! @mviereck,
First, thanks for such an amazing project. I have been using your tool in Linux without any problem, but right now I'm trying to use it in Windows with Docker WSL2 Backend and VcXsrv with runx. I think I have found a problem in the code and I have it nearly identified, but I need your help to make a valid PR because, to be honest, 9k bash lines are too much for me ;). The command line I'm running
The problem
So, it seems that in watchpidlist you are watching for what you call pid1pid (which I believe is the host PID for guest container PID 1). The thing is that, for some reason, in WSL, the guest process is not present in the host (as you can see in the next image).
So this makes the tool believe that the container is dead and ends the program.
As you might know, you are starting to watch this PID in: https://github.com/mviereck/x11docker/blob/60ab6d7875ffad490fd79852f9fda88f79a453f2/x11docker#L9022
So apparently, a possible solution could be use
-mobyvm
flag, and actually this fix the problem, but has other problems related with cleanup after close.Actually, changing this line with the same command present in the case where mobyvm is yes
setonwatchpidlist "CONTAINER$Containername" ;;
it seems to work, but probably I'm breaking other things, don't know.So, what do you think?