Bug 70849 - [bug] switching vt in drm mode accumulate open fds in weston-launch process
Summary: [bug] switching vt in drm mode accumulate open fds in weston-launch process
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: 1.3.0
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-24 20:19 UTC by Rafal Mielniczuk
Modified: 2013-10-25 20:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
weston-launch: close input fds in deactivate request (1.79 KB, patch)
2013-10-24 20:25 UTC, Rafal Mielniczuk
Details | Splinter Review

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.