mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Unresponsive Xephyr window after a few minutes of being in the background #345

Closed smac89 closed 3 years ago

smac89 commented 3 years ago

I am using x11docker to run the latest xfce desktop built from source. This is supposed to help serve as a development environment for hacking on XFCE. You can see the project here.

I use this command to run the container and it is running rootless with podman:

x11docker --debug --desktop \
    --clipboard \
    --size 1280x720 \
    --cap-default \
    --network=private \
    --init=dockerinit \
    --xephyr \
    --user=RETAIN \
    --name xfce-test \
    --pull=ask \
    --showenv \
    --showid \
    --showinfofile \
    --showpid1 \
    -- \
    ${LOCAL_XFCE:+--volume "$LOCAL_XFCE:/container/xfce/workdir:ro"} \
    -- \
    xfce-test/xfce-test-archlinux:dev

The problem I have is that after starting the container and the desktop is up and running, if I leave the Xephyr window running in the background for more than 5 minutes, the window becomes unresponsive to clicks.

I've done some testing and figured out that the problem is not XFCE itself, but rather the Xephyr window itself is not responding to mouse movements or clicks. I can do a podman exec -it xfce-test xfce4-terminal and sure enough, a terminal window pops open in the window, but I can't interact with it. I am forced to shutdown the entire application, and restart in order to be able to get access for another short period of time.

Is there something I can do to fix this? What am I missing the above options that may be causing this?

mviereck commented 3 years ago

if I leave the Xephyr window running in the background for more than 5 minutes, the window becomes unresponsive to clicks.

I've never seen this behaviour. It is likely not caused by any x11docker options. podman support is experimental yet. Please add --podman to make sure x11docker sets up right everything.

I guess an issue with the xfce screensaver. Please try to change the screensaver settings.

smac89 commented 3 years ago

I have completely disabled screensaver, and disabled powermanager display management, and still the same issue.

I can resize the window, and xfce resizes accordingly, but I still can't click anywhere within the window

mviereck commented 3 years ago

Can you reproduce the issue with x11docker/xfce? I did some test runs with your options and --podman, but cannot reproduce the issue so far.

Edit: Another check: Please install nxagent and try with --nxagent instead of --xephyr.

smac89 commented 3 years ago

Yes for some reason, the image you provided seems to be fine running in the background, but the ones I've tried do not. I addition to the one I was trying, I also tried https://hub.docker.com/r/schuellerf/xfce-test, and experienced the same issue.

Using nxagent produces the desired effect, but introduces weird artifacts into the desktop, like very thick shadows around the window and the panel. Also windows lag a lot when being dragged around.

I think it may have to do with version seeing as the ones I have tried are running the latest xfce from master and the one you have is on 4.12. There might be something I am missing 🤷🏽‍♂️

smac89 commented 3 years ago

Alright I got it. It seems the problem really had something to do with xfce's power management, and not xephyr.

After running the command:

xfconf-query -c xfce4-power-manager --create --property /xfce4-power-manager/presentation-mode --type 'bool' --set 'true'

I no longer experienced the freezing. I will make this a permanent part of the image. Thanks for your help

mviereck commented 3 years ago

Alright I got it.

Great!

It seems the problem really had something to do with xfce's power management

Maybe this should be reported to xfce developers?

Using nxagent produces the desired effect, but introduces weird artifacts into the desktop, like very thick shadows around the window and the panel. Also windows lag a lot when being dragged around.

I wonder why the freeze does not appear in nxagent, and why it has these other issues. I don't encounter this with x11docker/xfce.

Unfortunately the images you provide are very big and I can hardly download them with my current internet connection to run some tests myself. I'll build a small xfce image based on debian testing to get a more recent xfce version.

smac89 commented 3 years ago

Maybe this should be reported to xfce developers?

Yes! I will also do this. I am currently in the middle of reporting a bug with the terminal running inside the container.

ArcoLinux_2021-04-22_01-57-16

You wouldn't happen to have an idea of why this might be happening inside the container? 😄

mviereck commented 3 years ago

You wouldn't happen to have an idea of why this might be happening inside the container? 😄

Let's look at this in #346

mviereck commented 3 years ago

Using nxagent produces the desired effect, but introduces weird artifacts into the desktop, like very thick shadows around the window and the panel. Also windows lag a lot when being dragged around.

I can reproduce this with Xfce 4.16. I've implemented a new option --composite to fix this.

By default x11docker disables X extension Composite in nxagent because it can cause trouble. But some applications fail without it; so does Xfce 4.16. If using --nxagent, x11docker now prints a message with a hint to use --composite. If running --xephyr --composite=no I can reproduce the drawing issues, too.

I wonder if you can reproduce the freeze effect in nxagent now.