Bug 70849

Summary: [bug] switching vt in drm mode accumulate open fds in weston-launch process
Product: Wayland Reporter: Rafal Mielniczuk <rafal.mielniczuk2>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 1.3.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: weston-launch: close input fds in deactivate request

Description Rafal Mielniczuk 2013-10-24 20:19:48 UTC
In drm mode while switching vt, open input fds get accumulated in weston-launch process. This may lead to hang, when number of open fds hit system limit.

How to reproduce:
- Run weston in drm mode using weston-launch
- Switch vt a couple of times
- Observe open input devices in /proc/<weston-launch-pid/fd
Comment 1 Rafal Mielniczuk 2013-10-24 20:25:49 UTC
Created attachment 88089 [details] [review]
weston-launch: close input fds in deactivate request

This proposed fix tracks open input fds, and close them on deactivate request. One drawback I observed with this, is that it takes some time to reopen all input devices, so weston is unresponsive for like one second, after switching back to it.
Comment 2 Kristian Høgsberg 2013-10-25 20:36:32 UTC
I went with a slightly simpler fix, but also added support for the EVIOCREVOKE ioctl.  Also applied to 1.3.

commit 0eee0a28ba24dae62767bc5576c1e1b5dfe33869
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Oct 25 13:34:58 2013 -0700

    weston-launch: Revoke and close input fds when we vt switch away
    
    We used to leak the input fds, as weston would reopen all fds on vt
    enter.  We could just close them after sending the open fd through the
    socket, but this patch also adds support for the new EVIOCREVOKE evdev
    ioctl, that revokes the fd in question (including the copy that we
    sent to the compositor).
    
    https://bugs.freedesktop.org/show_bug.cgi?id=70849

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.