[Sugar-devel] [DESIGN] restart does not, and how to fix

James Cameron quozl at laptop.org
Sun Oct 11 21:56:07 EDT 2015


Sometimes the logout, restart or shutdown option in the buddy menu
does not work.  Restarts from the control panel are also affected.

No message is shown.  The user must notice the problem and use the
power button instead.

An underlying cause is an activity or application that does not
respond to the save yourself message, because it is in a loop, because
the system is heavily loaded, because it has made a blocking I/O
request in a cooperative multithreading model, or because memory is
very low.

Using the frame to stop a hung activity does not work, because
whatever has stopped the save yourself message also stops the close
message from the frame.

Technical users can hunt and kill the process.  There is no evidence
in logs.  It is very easy to reproduce using Terminal.

Other desktops handle this problem in the same way (Ubuntu Unity), or
by asking the user to solve the problem (Fedora Gnome), or by not
blocking (KDE, Mac OS X).

The design choices are;

- add a timeout of about 15 seconds, log, and then ignore the problem
  and continue,

  costs: may lose unsaved work,

  benefits: is simple to do and is tested, see #12813, comment:7,

- ask the user to solve the problem, with an alert,

  costs: will block waiting on user, wasting their time.

  benefits: avoids losing unsaved work.

- combination of both above, make the timeout visible and include a
  cancel button,

  costs: still possible to lose unsaved work,

  benefits: does complete operation if user does not respond.

Are there any other ways to solve this problem?  Solving it by fixing
activities has never worked, and cannot work because we are not in
control of all activities.  Also, some types of hang are outside the
control of the activity coder.

I'm fine with just adding a timeout, but are there any developers
interested in taking on the second or third choice?

If an alert is used, what should it say?  Is an alert from the shell
compatible with activities who may use an alert?

The rest of this mail is background information.


How to reproduce?

In the Terminal activity, send a SIGSTOP signal to the activity
process, like this:

	kill -STOP $(pgrep -f Terminal)

The Terminal activity will hang.  Now try to restart.


What does the session manager do?

The Sugar session manager is designed to control for the risk of
losing unsaved work.  The session manager is built into the shell.

Saving work costs power and reduces the product life of solid-state

So activities save on quit or when the session manager asks them to.

The session manager sends a standard "save yourself" message.

Saving automatically is an alternative, but it defeats versioning,
costs more power, and even if done frequently there may be time
between work done and the next automatic save.

See sugar:src/jarabe/model/session.py

On the other hand, a shutdown started from the power button might do
none of this.


How do other desktops handle programs that do not respond?

Sorted by desktop popularity.

KDE ignores the problem.  The desktop stops regardless of whether the
save yourself message is delivered.

Gnome and Mate display a message: "A program is still running: <name>
Not responding.  Waiting for the program to finish.  Interrupting the
program may cause you to lose work.  <buttons> Lock Screen.  Cancel.
Log Out Anyway."  Even though this dialog is shown, the desktop may at
any moment continue with the logout, restart or shutdown if the
activity or application responds late to the save yourself message.

Unity on Ubuntu 14.04 LTS and 15.04 does nothing.  The logout, restart
or shutdown does not succeed, no dialog is shown, and the user is not
told of the problem.



1.  https://dev.laptop.org/ticket/12813
2.  https://bugs.sugarlabs.org/ticket/2628
3.  https://bugs.sugarlabs.org/ticket/3487
4.  https://bugs.sugarlabs.org/ticket/4345
5.  https://bugs.sugarlabs.org/ticket/4864

James Cameron

More information about the Sugar-devel mailing list