CuarzoSoftware / Louvre

C++ library for building Wayland compositors.
MIT License
506 stars 14 forks source link

Lockup in getPpidFromProc #69

Closed panaflexx closed 1 month ago

panaflexx commented 1 month ago

When switched away from the Louvre server vt, a new wayland client will lock up the Louvre server.

Steps to reproduce:

  1. Start louvre-views
  2. Change VT (chvt 2)
  3. Start any wayland application
    WAYLAND_DISPLAY="wayland-2" ./wayst

------------ STACK TRACE -----------

0 0x00007f12e0d3c5b4 in __libc_open64 (file=0x7ffdaa34ec10 "/proc/-1/status", oflag=0) at ../sysdeps/unix/sysv/linux/open64.c:41

1 0x00007f12e0cb40b6 in GIIO_file_open

(fp=fp@entry=0x561c05f37060, filename=<optimized out>, posix_mode=<optimized out>, prot=prot@entry=438, read_write=8, is32not64=<optimized out>)
at ./libio/fileops.c:188

2 0x00007f12e0cb4412 in _IO_new_file_fopen (fp=fp@entry=0x561c05f37060, filename=filename@entry=0x7ffdaa34ec10 "/proc/-1/status", mode=,

mode@entry=0x561c0505e23b "r", is32not64=is32not64@entry=1) at ./libio/fileops.c:280

3 0x00007f12e0ca76ae in __fopen_internal (is32=1, mode=0x561c0505e23b "r", filename=0x7ffdaa34ec10 "/proc/-1/status") at ./libio/iofopen.c:75

4 _IO_new_fopen (filename=0x7ffdaa34ec10 "/proc/-1/status", mode=0x561c0505e23b "r") at ./libio/iofopen.c:86

5 0x0000561c0501ff41 in getPpidFromProc(int) ()

6 0x0000561c050209ef in Client::Client(void const*) ()

7 0x0000561c0503e0a0 in Compositor::createObjectRequest(Louvre::LFactoryObject::Type, void const*) ()

8 0x00007f12e16695bf in clientConnectedEvent(wl_listener, void) () at /usr/local/lib/x86_64-linux-gnu/libLouvre.so.2

9 0x00007f12e0c1e290 in () at /lib/x86_64-linux-gnu/libwayland-server.so.0

10 0x00007f12e0c1fd7c in wl_client_create () at /lib/x86_64-linux-gnu/libwayland-server.so.0

11 0x00007f12e0c1fecc in () at /lib/x86_64-linux-gnu/libwayland-server.so.0

12 0x00007f12e0c1deea in wl_event_loop_dispatch () at /lib/x86_64-linux-gnu/libwayland-server.so.0

13 0x00007f12e163977d in Louvre::LCompositor::processLoop(int) () at /usr/local/lib/x86_64-linux-gnu/libLouvre.so.2

14 0x0000561c05013a9d in main ()

(gdb)

ehopperdietzel commented 1 month ago

Thank you for reporting this, when you mention lock up, do you mean that you can’t return to the Louvre session, or that the compositor freezes after you return to the session?

Could you please confirm if this issue also occurs with louvre-weston-clone?

I couldn't replicate it here. However, I did notice that when typing the chvt N command from a terminal inside Louvre, session switching seems to occur before the terminal app receives a release event for the Enter key. This triggers the key-auto-repeat on the client side, so when I return to the Louvre session, the terminal looks as if Enter was pressed multiple times. So maybe this is causing the bug on your side. Could you try switching sessions using the fn + Ctrl + Alt + [F1,F2,...] keys instead of the chvt command?

Finally, could you tell me which Louvre and SRM version are you using?

ehopperdietzel commented 1 month ago

I think I had a bug preventing exiting a while loop when getPpidFromProc() fails in louvre-views. I pushed the changes to the devel branch. Could you let me know if that fixes it?

panaflexx commented 1 month ago

Thanks I will check the fix. It's a hard lockup with no input - I have to ssh into the affected machine and kill it.

ehopperdietzel commented 1 month ago

Yes, unfortunately, this kind of bug can only be tested with the DRM backend. However, I'm sure that the change I added to the devel branch should fix it.

panaflexx commented 1 month ago

I fixed the issue... while loop never exits when return is -1

diff --git a/src/examples/louvre-views/src/Client.cpp b/src/examples/louvre-views/src/Client.cpp index 80f1393..78ea371 100644 --- a/src/examples/louvre-views/src/Client.cpp +++ b/src/examples/louvre-views/src/Client.cpp @@ -162,7 +162,7 @@ Client::Client(const void *params) : LClient(params), Int32 ppid = pid;

 // Search the AppDock item that started it (if any)
panaflexx commented 1 month ago

Yup - devel branch fixes the issue.

ehopperdietzel commented 1 month ago

Thank you!