all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Toby Cubitt <toby-dated-1477500695.5894b7@dr-qubit.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24640@debbugs.gnu.org, phillip.lord@russet.org.uk, rrt@sc3d.org
Subject: bug#24640: Crashes in 25.1
Date: Wed, 12 Oct 2016 17:56:56 +0100	[thread overview]
Message-ID: <20161012165656.GA19297@marvin.cs.ucl.ac.uk> (raw)
In-Reply-To: <83vawxaaoo.fsf@gnu.org>

On Wed, Oct 12, 2016 at 05:44:55PM +0300, Eli Zaretskii wrote:
> What's more, the steps to reproduce may be simple (start Emacs and
> wait for it to crash), finding the code that is the culprit for this
> is anything but easy.  The crash is triggered by GC, and is due to an
> invalid object being present in the value of read_objects, which holds
> the object read by Emacs with the #n=object form.  The problem is that
> the faulty object is deep in that list, so catching the code that puts
> it there is not easy.  I'm still trying to devise a way for that, with
> no real success so far.

I understand. I can't help at all with the GC bug, unfortunately, as it's
well outside my Emacs knowledge.

I know what the buffer-undo-tree data structure looks like that gets
written and read from file, so if I can help at any point by picking
apart or simplifying that lisp structure, let me know.

> > > Some functions in undo-tree refer to or manipulate Emacs undo
> > > internals:
> > > 
> > >   undo-list-pop-changeset
> > >   undo-list-transfer-to-tree
> > >   undo-list-rebuild-from-tree
> > >   undo-tree-pull-undo-in-region-branch
> > >   undo-tree-pull-redo-in-region-branch
> > >   undo-tree-adjust-elements-to-elt
> > >   undo-tree-apply-deltas
> > >   undo-tree-undo-1
> > >   undo-tree-redo-1
> > > 
> > > Do they perhaps need some adjustments to Emacs 25's undo?
> > 
> > The only Emacs undo internal that undo-tree manipulates is the
> > buffer-undo-list variable. The only functions that do so are:
> > 
> >   undo-list-pop-changeset
> >   undo-list-transfer-to-tree
> >   undo-list-rebuild-from-tree
> > 
> > All the others either call one of these, or only touch buffer-undo-tree
> > which is a variable defined in the undo-tree package and which the Emacs
> > undo internals know nothing about.
> > 
> > Has the format of buffer-undo-list has changed at all? If so, then the
> > three above might need adjustment. If not, they should work as before.
> > 
> > The only other Emacs undo internals used by undo-tree are to call
> > primitive-undo and undo-boundary when undo/redoing.
> 
> I counted this last class among those listed above.

Indeed. I was attempting to explain which ones manipulate
buffer-undo-list "behind Emacs' back", and which ones just call out to
undo functions.

In case it helps, note that none of the above functions get called when
reloading history from file.

> > > Another potential issue is the new undo timer we have in Emacs 25 (see
> > > undo-auto--boundary-ensure-timer in simple.el).  One way of checking
> > > whether this is related to the crashes is to modify that function to
> > > use a much larger value for the 1st argument of run-at-time, say
> > > 10000, so that the undo timer never fires during the startup.  Reuben,
> > > could you try that?
> > 
> > As far as I understand, the timer just adds undo boundaries to
> > buffer-undo-list in some of the open buffers. Undo-tree doesn't touch
> > buffer-undo-list (or do anything at all, in fact) until you call one of
> > its interactive commands.
> 
> Does restoring undo-tree history manipulates buffer-undo-list of any
> buffers in any way?

No. It just reads a lisp structure from file into the buffer-undo-tree
variable.

> > Since the timer can't run whilst undo-tree lisp code is running
> 
> It can run if during restoring the history, undo-tree calls sit-for, or
> asks a question, or calls some other API that enters redisplay and/or
> involves user input.

During history loading it doesn't access buffer-undo-list at all, so it
shouldn't matter if the timer runs.

When undoing, everything that accesses or touches buffer-undo-list is
encapsulated in the three functions I listed. None of these call sit-for,
prompt for input, or display anything. As far as I understand it, they
shouldn't be able to trigger redisplay at all (caveat I'm no redisplay
expert - that's you!)

I don't think the undo timer can trigger elsewhere during undo-tree
undo. Even if it does somehow trigger outside those three functions, this
shouldn't break anything. Depending on when it triggers, undo-tree will
either pick up the extra undo boundary added to buffer-undo-list this
time around, or next time you undo.

> > I'd be surprised if the new undo timer is the culprit.
> 
> It could be a culprit, but evidently isn't, as Reuben already tried to
> disable it.

Indeed. But even if it's not to blame here, I still ought double-check
the above carefully to make sure the new undo timer doesn't interact with
undo-tree in some subtle way I've overlooked.

Cheers,
Toby
-- 
Dr T. S. Cubitt
Royal Society University Research Fellow
Quantum Information Theory
Department of Computer Science
University College London

email: tsc25@cantab.net
web:   www.dr-qubit.org





  reply	other threads:[~2016-10-12 16:56 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 23:12 bug#24640: Crashes in 25.1 Reuben Thomas
2016-10-08  5:53 ` Eli Zaretskii
2016-10-08 13:28   ` Reuben Thomas
2016-10-08 13:30   ` Reuben Thomas
2016-10-08 14:30     ` Eli Zaretskii
2016-10-08 15:26       ` Reuben Thomas
2016-10-08 15:34         ` Eli Zaretskii
2016-10-08 22:08           ` Reuben Thomas
2016-10-09  7:05             ` Eli Zaretskii
2016-10-09  7:45               ` Reuben Thomas
2016-10-09  9:57                 ` Eli Zaretskii
2016-10-09 20:21                   ` Reuben Thomas
2016-10-10  6:15                     ` Eli Zaretskii
2016-10-10 16:12                       ` Reuben Thomas
2016-10-10 16:33                         ` Eli Zaretskii
2016-10-10 17:01                           ` Reuben Thomas
2016-10-10 17:05                             ` Eli Zaretskii
2016-10-10 17:06                               ` Reuben Thomas
     [not found]                           ` <CAOnWdoheXTvdasXN8vQFZPyayZVHD-QweqJupVrS8BQFxj2iGw@mail.gmail.com>
     [not found]                             ` <831szodsus.fsf@gnu.org>
     [not found]                               ` <CAOnWdojJHhajbRcinnubLfwWhY=snydnPM7Cws9ktX+pJe8aGA@mail.gmail.com>
     [not found]                                 ` <83zimccbzr.fsf@gnu.org>
     [not found]                                   ` <CAOnWdojzYsTR=wyrn-k2dJbStej89neskr=vwZQQWrQVCGtpkA@mail.gmail.com>
2016-10-11 11:59                                     ` Eli Zaretskii
2016-10-11 14:08                                       ` Reuben Thomas
2016-10-11 14:53                                         ` Eli Zaretskii
2016-10-11 15:19                                           ` Eli Zaretskii
2016-10-11 15:42                                             ` Reuben Thomas
2016-10-11 16:26                                               ` Eli Zaretskii
2016-10-11 15:41                                           ` Reuben Thomas
2016-10-11 16:33                                             ` Eli Zaretskii
2016-10-11 16:41                                               ` Reuben Thomas
2016-10-12 10:31                                               ` Eli Zaretskii
2016-10-12 10:57                                                 ` Reuben Thomas
2016-10-12 11:14                                                   ` Eli Zaretskii
2016-10-12 13:50                                                 ` Toby Cubitt
2016-10-12 14:44                                                   ` Eli Zaretskii
2016-10-12 16:56                                                     ` Toby Cubitt [this message]
2016-10-12 17:28                                                       ` Eli Zaretskii
2016-10-12 18:07                                                         ` Toby Cubitt
2016-10-12 19:15                                                           ` Eli Zaretskii
2016-10-12 20:45                                                             ` Reuben Thomas
2016-10-14 20:06                                                               ` Eli Zaretskii

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=20161012165656.GA19297@marvin.cs.ucl.ac.uk \
    --to=toby-dated-1477500695.5894b7@dr-qubit.org \
    --cc=24640@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=phillip.lord@russet.org.uk \
    --cc=rrt@sc3d.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.