[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [olpc-software] graceful handling of out-of-memory conditions



> On Tue, Mar 28, 2006 at 01:11:09PM +1000, Martin Sevior wrote:
>>
>> As a data point in this discussion, AbiWord has a segfault handler that
>> saves the current document to disk upon receiving a variety of signals
>> including 11 of course.
>>
>> I'll have to look at the code to see if we require memory allocation to
>> write the data to disk. We probably do. We might be able to save the
>> situation by releasing memory before writing to disk.
>
> I rather hope AbiWord doesn't need memory allocation if its running an
> autosave in a SEGV handler - all bets are off when a process receives,
> a SEGV - the chances of malloc() continuing to work are slim. I've lost
> count of the number of crash debugging exercises where I needed a
> LD_PRELOAD
> library to override a SEGV handler which was doing something which just
> caused further corruption / SEGVs!
>
> If it really is neccessary to do work in a SEGV handler, one must at least
> pre-allocate any memory one expects to need, and also preferrably allocate
> an altsigstack. Even then expect it fail a percentage of the time.
>

Yes, this concerned me when we implemented it. In practice it appears to
work reasonably well. I think you generally have about a 95% chance of
getting a workable document. Of course it could be that the SEGV was
triggered by a bug in the document structure in which case, sorry there is
nothing we can do.

We don't do much memory allocation on write to disk when exporting to the
*.abw format which is basically an XMLized dump of our document model.


> If the overhead of performing the auto-save can be reduced to a level
> where the user won't notice any delay, then it'd be preferrable to
> autosave
> continuously throughout use - say after 'x' kb more text have been entered
> in a document, or when an non-trivial operation of is performed on a doc,
> or say when the window manager minimizes the document window.
>

We have already an implemented an autosave every XX minutes where XX can
be  as small as one minute. The performance is acceptable. Write to *.abw
is very fast.

I would like to implement an auto-recover after OOM. It would not be too
much work and would be a reasonable work-around. ie After OOM, the user
presses the Abiword button on the panel and the document returns with the
caret in the same place as just before the death signal.

Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]