Find a file
Pekka Paalanen 826dc14ec4 shell: fix race on desktop-shell exit
The desktop shell plugin registers both a wl_client destroy signal
listener, and a sigchld handler, when launching weston-desktop-shell.
However, nothing guarantees in which order do the wl_client destructor
and the sigchld handler run.

Luckily, the sigchld handler cannot interrupt any code, because we
handle the signal via signalfd, which means it is handled like any event
in the compositor's main event loop.

Still, shell.c has a race, that when lost, can cause a crash, as
described in bug #82957.

If the sigchld handler happens to run first, it will try to launch a new
weston-desktop-shell without removing the destroy listener from the old
wl_client first. This leads to list corruption, that may cause a crash
when the old wl_client gets destroyed.

Simply removing the destroy listener in the sigchld handler is not
enough, because respawning sets shell->child.client pointer, and if
the wl_client destructor runs after, it will reset it to NULL.

OTOH, the wl_client destroy handler cannot reset shell->child.process,
because that would cause the sigchld handler in weston core to not find
the process tracker anymore, and report that an unknown process exited.

Turns out, that to make everything work, we would need to wait for both
the wl_client destructor and the sigchld handler to have run, before
respawn. This gets tricky.

Instead, solve the problem by removing shell->child.process. Use the new
weston_client_start() which automatically creates and manages the struct
weston_process. The shell does not need to know about the process exit,
it only needs to know about the client disconnect. Weston-desktop-shell
will never attempt to reconnect, and it would not work even if it did,
so disconnect is equivalent to weston-desktop-shell exiting.

This should permanently solve the race for weston-desktop-shell.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82957
Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2014-08-28 10:15:38 +03:00
clients window: unbind egl surface and context on surface release 2014-08-27 16:37:44 +03:00
data build: Move data/Makefile.am into Makefile.am 2014-01-31 23:49:39 -08:00
desktop-shell shell: fix race on desktop-shell exit 2014-08-28 10:15:38 +03:00
fullscreen-shell fullscreen-shell: Fix compiler warnings 2014-08-08 18:07:34 +03:00
m4 weston-build: Fix aclocal error during autogen.sh 2014-06-21 10:33:21 -07:00
man Document output/scale configuration option in the weston.ini man page. 2014-08-27 16:27:36 +03:00
protocol protocol: fix a wrong word in wl_viewport.set_source 2014-08-27 15:46:22 +03:00
shared tests: allow running make check without make install 2014-08-22 17:47:33 +03:00
src compositor: add weston_client_start() 2014-08-28 10:15:10 +03:00
tests tests: allow running make check without make install 2014-08-22 17:47:33 +03:00
wcap wcap: Check for mmap and malloc return value in wcap decode module 2014-05-06 15:21:27 -07:00
xwayland wm: Don't subtract the margins from the configured size 2014-08-27 17:21:01 +03:00
.gitignore Add a simple client for testing compositor damage handling 2014-06-18 10:45:50 -07:00
autogen.sh Update autotools configuration 2010-11-06 21:04:03 -04:00
configure.ac configure.ac: require libwayland 1.5.91 2014-08-26 13:31:42 +03:00
COPYING Add COPYING 2012-04-25 10:17:42 -04:00
Makefile.am build: do not run xwayland test for distcheck 2014-08-22 16:08:20 +03:00
notes.txt Add informal notes file 2012-10-25 15:00:42 -04:00
README README: Fix typo; add link to testing docs 2014-02-05 17:20:24 -08:00
releasing.txt Add releasing.txt to describe the release steps and other bits of process 2014-05-23 10:13:59 -07:00
weston.ini.in libinput: Add tap configuration to weston.ini 2014-08-15 15:33:55 +03:00

Weston

Weston is the reference implementation of a Wayland compositor, and a
useful compositor in its own right.  Weston has various backends that
lets it run on Linux kernel modesetting and evdev input as well as
under X11.  Weston ships with a few example clients, from simple
clients that demonstrate certain aspects of the protocol to more
complete clients and a simplistic toolkit.  There is also a quite
capable terminal emulator (weston-terminal) and an toy/example desktop
shell.  Finally, weston also provides integration with the Xorg server
and can pull X clients into the Wayland desktop and act as a X window
manager.

Refer to http://wayland.freedesktop.org/building.html for building
weston and its dependencies.

The test suite can be invoked via `make check`; see
http://wayland.freedesktop.org/testing.html for additional details.