9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] acme crash recovery
Date: Tue, 15 Aug 2006 19:20:28 +0100	[thread overview]
Message-ID: <08cc4ae9d4a860824f3ddbbbd856db4a@vitanuova.com> (raw)
In-Reply-To: <09dd2f54ac4e761c7b3fa19388d756e1@plan9.bell-labs.com>

> acme, like sam, keeps a log of changes in /tmp/*acme.  I believe that
> such a file contains enough to reconstruct acme's state when (or
> shortly before) it crashed, but I don't know of an automated means of
> doing so.

i've done this, with mixed results, on a couple of occasions. it's almost
always more hassle than it's worth.

for a start acme doesn't keep all its state in the /tmp/*acme files, only that
which has been flushed out of memory. i looked into this, but can't
now remember what the criteria are. anyway, the temp file doesn't hold
all the metadata necessary for its reconstruction - it's just used as an external
adjunct to main memory. so you tend to get old and new versions of fragments
of text in different parts of the file. also, it's worth noting that
the characters in the file are held as two-byte runes (local endian). luckily they're
all two-byte aligned, otherwise things would be even harder.

i modified strings(1) to dump rune-based strings with no length restriction.
this provides a start, but more often than not the text you're looking for
is not in the file.

the most successful technique was when my mouse was unplugged (plugging it in
did not cause it to start working again). typing enough text in the current
window caused the text to be flushed to the temp file, enabling its retrieval
from another terminal, assuming you're using a remote fs.

acme does dump when it catches a note, but depending on the
circumstances sometimes just truncates the dump file, which can erase whatever
stuff you already had!

a couple of changes i've long contemplated:
  - if you restored acme from a given dump file, it should dump to the same file.
  - dumping should be "safe" - i.e. it should create the file under another name and dump to it
    before moving the original out of the way, moving the new file to the dump file and finally removing the original.
    less chance of erasing precious data this way.
  - an option to get acme to do an automatic dump every so often. (e.g. to acme.backup.dump)

but i'm also aware that these changes might be anathema to purists...


  reply	other threads:[~2006-08-15 18:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-06 15:59 Sascha Retzki
2006-08-07  8:57 ` Robert Raschke
2006-08-07 10:08 ` erik quanstrom
2006-08-07  2:28   ` geoff
2006-08-15 18:20     ` rog [this message]
2006-08-15 18:36       ` Paul Lalonde
2006-08-07  6:31   ` Charles Forsyth
2006-08-08 14:34 ` [9fans] DNS and ICMP Sha0lin
2006-08-08 16:53   ` ISHWAR RATTAN
2006-08-08 20:17   ` erik quanstrom
     [not found] ` <000601c6baf9$5657b750$14aaa8c0@utelsystems.local>
2006-08-09  6:53   ` "Nils O. Selåsdal"
2006-08-07 18:15 [9fans] acme crash recovery Sascha Retzki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08cc4ae9d4a860824f3ddbbbd856db4a@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).