[PATCH weston] shell: quit weston, if weston-desktop-shell dies early
Pekka Paalanen
ppaalanen at gmail.com
Mon Sep 1 00:21:19 PDT 2014
On Thu, 28 Aug 2014 09:59:35 -0700
Jason Ekstrand <jason at jlekstrand.net> wrote:
> Really, do we need a whole 30 seconds? You can easily do enough
> interaction to crash something in 30 seconds. Other than that, this looks
> fine.
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
The timeout starts to run on shell module load, and I wanted to allow
plenty of time for weston-desktop-shell to start, in case the system
is heavily loaded and slow. Perhaps even the backend will be switching
from Pixman to GLES renderer later, which might... affect something.
And if weston-desktop-shell also is using GL via Cairo, I suppose it
could take some time to start before it could crash. But yes, in normal
circumstances 30 seconds is over the top.
Yet, IMO, 30 seconds should be short enough that the user won't have
time to do anything serious; he can start apps etc. yes, but an app
closing because the display server goes down should not cause much loss.
We can adjust the timeout easily later, if you think it's really too
long.
Pushed.
Thanks,
pq
> On Thu, Aug 28, 2014 at 1:48 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>
> > From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> >
> > If weston-desktop-shell dies soon after launch, or maybe cannot be
> > executed at all, let weston exit rather than letting the user stare at a
> > black screen.
> >
> > But, do not exit weston, if weston-desktop-shell dies later, as the user
> > may already have apps open, and those apps would likely still function
> > correctly. This gives the user the opportunity to save his work and
> > close the apps properly.
> >
> > This should make one class of "I see only black screen" failures obvious.
> >
> > Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > ---
> > desktop-shell/shell.c | 32 +++++++++++++++++++++++++++++++-
> > desktop-shell/shell.h | 3 +++
> > 2 files changed, 34 insertions(+), 1 deletion(-)
> >
> > diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> > index c21d364..26f13cc 100644
> > --- a/desktop-shell/shell.c
> > +++ b/desktop-shell/shell.c
> > @@ -5298,6 +5298,32 @@ shell_surface_configure(struct weston_surface *es,
> > int32_t sx, int32_t sy)
> > }
> > }
> >
> > +static bool
> > +check_desktop_shell_crash_too_early(struct desktop_shell *shell)
> > +{
> > + struct timespec now;
> > +
> > + if (clock_gettime(CLOCK_MONOTONIC, &now) < 0)
> > + return false;
> > +
> > + /*
> > + * If the shell helper client dies before the session has been
> > + * up for roughly 30 seconds, better just make Weston shut down,
> > + * because the user likely has no way to interact with the desktop
> > + * anyway.
> > + */
> > + if (now.tv_sec - shell->startup_time.tv_sec < 30) {
> > + weston_log("Error: %s apparently cannot run at all.\n",
> > + shell->client);
> > + weston_log_continue(STAMP_SPACE "Quitting...");
> > + wl_display_terminate(shell->compositor->wl_display);
> > +
> > + return true;
> > + }
> > +
> > + return false;
> > +}
> > +
> > static void launch_desktop_shell_process(void *data);
> >
> > static void
> > @@ -5340,7 +5366,9 @@ desktop_shell_client_destroy(struct wl_listener
> > *listener, void *data)
> > * returning.
> > */
> >
> > - respawn_desktop_shell_process(shell);
> > + if (!check_desktop_shell_crash_too_early(shell))
> > + respawn_desktop_shell_process(shell);
> > +
> > shell_fade_startup(shell);
> > }
> >
> > @@ -6407,5 +6435,7 @@ module_init(struct weston_compositor *ec,
> >
> > shell_fade_init(shell);
> >
> > + clock_gettime(CLOCK_MONOTONIC, &shell->startup_time);
> > +
> > return 0;
> > }
> > diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
> > index 67c5f50..2cfd1d6 100644
> > --- a/desktop-shell/shell.h
> > +++ b/desktop-shell/shell.h
> > @@ -23,6 +23,7 @@
> > */
> >
> > #include <stdbool.h>
> > +#include <time.h>
> >
> > #include "compositor.h"
> >
> > @@ -209,6 +210,8 @@ struct desktop_shell {
> > enum desktop_shell_panel_position panel_position;
> >
> > char *client;
> > +
> > + struct timespec startup_time;
> > };
> >
> > struct weston_output *
> > --
> > 1.8.5.5
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
More information about the wayland-devel
mailing list