2005-03-17 20:27:24

by Allison

[permalink] [raw]
Subject: linux: detect application crash

Hi,

Several times when I worked with Windows, I have had a scenario when I
am editing a file and saved some time ago and then the application
crashes and I lose all recent data.

Can the operating system detect all application crashes ? If so, why
can't the OS save the user data to disk before the application quits ?

How does this work in Linux. I was curious if such a functionality
already exists in Linux. If not, what are the issues involved in
implementing this functionality.

thanks
Allison


2005-03-17 20:33:44

by Robert Love

[permalink] [raw]
Subject: Re: linux: detect application crash

On Thu, 2005-03-17 at 15:27 -0500, Allison wrote:

> Several times when I worked with Windows, I have had a scenario when I
> am editing a file and saved some time ago and then the application
> crashes and I lose all recent data.
>
> Can the operating system detect all application crashes ? If so, why
> can't the OS save the user data to disk before the application quits ?
>
> How does this work in Linux. I was curious if such a functionality
> already exists in Linux. If not, what are the issues involved in
> implementing this functionality.

It is hard to just wholesale "save the user's data" because the
application is crashing, things are inconsistent, something is broken,
etc.

But it is possible to dump all memory (a core dump). Linux does this
now.

It is also possible to catch a segfault and handle it. Various GUI
libraries do this. For example, GNOME handles segfaults, presenting the
user with various options (send bug report, restart application, etc).

The best bet, from an application developer's standpoint, is to just not
crash. Second best, save early and save often.

Robert Love


2005-03-17 23:49:15

by Robert Hancock

[permalink] [raw]
Subject: Re: linux: detect application crash

Allison wrote:
> Hi,
>
> Several times when I worked with Windows, I have had a scenario when I
> am editing a file and saved some time ago and then the application
> crashes and I lose all recent data.
>
> Can the operating system detect all application crashes ? If so, why
> can't the OS save the user data to disk before the application quits ?
>
> How does this work in Linux. I was curious if such a functionality
> already exists in Linux. If not, what are the issues involved in
> implementing this functionality.

The OS doesn't have enough information to be able to save the app's data
in the event of a crash in a form that would be usable or meaningful,
since only the app knows what format its data structures are in.

The app itself could do this (installing a signal handler for segfaults,
etc.) but the problem is that whatever caused the program to crash may
have also left its data in a messed-up state.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/