all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39962@debbugs.gnu.org, pieter-l@vanoostrum.org, eggert@cs.ucla.edu
Subject: bug#39962: 27.0.90; Crash in Emacs 27.0.90
Date: Thu, 12 Mar 2020 20:36:10 +0000	[thread overview]
Message-ID: <CAOqdjBdscissdCY8V0NHnkZeydNJJn-XEZoyTbMm2gzFvTTkKA@mail.gmail.com> (raw)
In-Reply-To: <83blp1siku.fsf@gnu.org>

On Thu, Mar 12, 2020 at 3:23 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > > > > Did you audit all the users of this function, both direct and
> > > > > indirect?  Some of them are outside of GC.
> > > >
> > > > Thanks for the comment; I just re-checked, and they look fine to me.
> > >
> > > ??? Fine in what way?
> >
> > It doesn't affect visible behavior of any callers, except in the case
> > where the previous behavior was buggy.
>
> I guess we have different notions of "visible"

Please say something about your notion of "visible". It doesn't affect
any of the existing C callers of valid_lisp_object_p. Are you talking
about printing valid_lisp_object_p(x) in a debugger, and not getting
the expected value? Or something else?

> and "buggy".

It avoids segfaults or random memory corruption. How is that not "buggy"?

> > I'm most certainly not changing the semantics of live_buffer, if
> > that's what you're worried about. I am changing the semantics of
> > live_buffer_p, which is an internal function, and my initial patch
> > also changed the return value of valid_lisp_object_p, to another value
> > that would be treated equivalently. If there are objections to that,
> > we can easily distinguish the two cases.
>
> I actually don't understand why we need to make such a change.

Which change? Treating the two cases differently? Because the garbage
collector needs to know whether an object is reachable, not whether
it's still a live buffer.

valid_lisp_object_p is currently documented to return 2 for a killed
buffer and 1 for a live buffer, which is weird since they're both
valid. It also returns 1 for some fake objects which aren't actually
valid:

(gdb) p current_thread->m_current_buffer
$3 = (struct buffer *) 0x555556694b10
(gdb) p valid_lisp_object_p(0x555556694b15)
$4 = 1
(gdb) p valid_lisp_object_p(0x555556694b25)
$5 = 1

Luckily, no one relies upon that documented mis-feature, so it's safe
to remove it.

> > And I think "so we don't collect reachable objects" is a fairly good
> > reason, generally.
>
> I didn't say it wasn't good, I said it didn't justify the proposed
> solution.

> How about if you tell more about the root cause of the crash you are
> trying to solve, and why disregarding the fact that a buffer is killed
> is the way to solve it?

I can try.

The garbage collector needs to mark all reachable objects. It can get
away with marking unreachable objects (and does so, for overlays in
killed buffers), but not marking a reachable object is a serious bug.

If a buffer is live, everything is fine.

If a buffer has been killed but is unreachable, everything is fine; it
will be collected by GC.

If a buffer has been killed but is reachable through mark_object,
everything is fine.

If a buffer has been killed but is reachable only through
mark_maybe_object, we fail to mark it.

We should mark it. In fact, whether a buffer object is marked should
depend only on whether it's reachable, not whether it's "live" in some
other sense.

That's all my patch does.

> > > The problem you are trying to solve is rare
> >
> > I think it would become much less rare with lexical binding in effect,
> > at least when the code's byte-compiled.
>
> That remains to be seen.

How about we put out the fire rather than waiting to see whether it
causes any damage? And, if we can agree to do so, what would you like
a patch which is actually meant for inclusion into the emacs-27 branch
(my previous patch wasn't, obviously) to look like?

> > > since this code was with us since 20 years ago without
> > > anyone bumping into it,
> >
> > That we know of. They might have just accrued it to random Emacs crashes.
>
> Then again, they might not.  We don't really have any evidence to that
> effect, all we know is that the code survived virtually intact since
> the day it was written.

I have no idea what you're trying to get at here.





  reply	other threads:[~2020-03-12 20:36 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 23:55 bug#39962: 27.0.90; Crash in Emacs 27.0.90 Pieter van Oostrum
2020-03-07  7:48 ` Eli Zaretskii
2020-03-07  8:40   ` Pieter van Oostrum
2020-03-07  8:41   ` Pieter van Oostrum
2020-03-07 10:51     ` Eli Zaretskii
2020-03-07 11:06   ` Pieter van Oostrum
2020-03-07 13:10     ` Eli Zaretskii
2020-03-07 15:06       ` Pieter van Oostrum
2020-03-07 15:17         ` Eli Zaretskii
2020-03-07 15:49           ` Pieter van Oostrum
2020-03-07 16:07             ` Eli Zaretskii
2020-03-07 17:21               ` Pieter van Oostrum
2020-03-07 18:01                 ` Eli Zaretskii
2020-03-07 19:14                   ` Pieter van Oostrum
2020-03-07 19:21                     ` Eli Zaretskii
2020-03-07 22:07                       ` Pieter van Oostrum
2020-03-09  4:00     ` Pip Cet
2020-03-08  7:42 ` Paul Eggert
2020-03-08  9:34   ` Pieter van Oostrum
2020-03-08 10:05     ` Paul Eggert
2020-03-08 21:37       ` Pieter van Oostrum
2020-03-08 21:58         ` Pieter van Oostrum
2020-03-08 22:34         ` Paul Eggert
2020-03-08 23:58           ` Pieter van Oostrum
2020-03-09  0:01             ` Paul Eggert
2020-03-09 13:26               ` Pieter van Oostrum
2020-03-09 17:10                 ` Eli Zaretskii
2020-03-09 19:48                   ` Pieter van Oostrum
2020-03-10 13:37                     ` Pieter van Oostrum
2020-03-09 19:51                   ` Paul Eggert
2020-03-09 21:32                     ` Pieter van Oostrum
2020-03-10 10:52                       ` Pieter van Oostrum
2020-03-10 14:19                         ` Pip Cet
2020-03-10 16:36                           ` Pieter van Oostrum
2020-03-11 14:32                             ` Pip Cet
2020-03-11 15:16                               ` Pieter van Oostrum
2020-03-11 15:43                                 ` Pip Cet
2020-03-11 15:51                                   ` Paul Eggert
2020-03-11 16:21                                     ` Eli Zaretskii
2020-03-11 17:52                                   ` Eli Zaretskii
2020-03-11 18:53                                     ` Pip Cet
2020-03-11 19:34                                       ` Eli Zaretskii
2020-03-12 10:32                                         ` Pip Cet
2020-03-12 15:23                                           ` Eli Zaretskii
2020-03-12 20:36                                             ` Pip Cet [this message]
2020-03-13  9:39                                               ` Eli Zaretskii
2020-03-13 13:56                                                 ` Pip Cet
2020-03-13 16:30                                                   ` Eli Zaretskii
2020-03-14  9:02                                                     ` Pip Cet
2020-03-14 15:39                                                       ` Pip Cet
2020-03-14 16:00                                                         ` Paul Eggert
2020-03-14 16:15                                                           ` Pip Cet
2020-03-14 16:57                                                             ` Eli Zaretskii
2020-03-14 18:34                                                               ` Pip Cet
2020-03-14 19:09                                                                 ` Paul Eggert
2020-03-14 20:10                                                                   ` Eli Zaretskii
2020-03-15 12:12                                                                     ` Pip Cet
2020-03-15 14:53                                                                       ` Eli Zaretskii
2020-03-15 12:09                                                                   ` Pip Cet
2020-03-15 14:50                                                                     ` Eli Zaretskii
2020-03-16 16:31                                                     ` Stefan Monnier
2020-03-11 20:03                                   ` Pieter van Oostrum
2020-03-12 13:55                                     ` Pip Cet
2020-03-12 18:13                                       ` Pieter van Oostrum
2020-03-12 20:00                                         ` Pip Cet
2020-03-13  8:09                                           ` Eli Zaretskii
2020-03-13  8:39                                             ` Pip Cet
2020-03-13  9:19                                               ` Eli Zaretskii
2020-03-13 17:43                                                 ` Pieter van Oostrum
2020-03-14  3:38                                                 ` Richard Stallman
2020-03-14  8:37                                                   ` Eli Zaretskii
2020-03-14  9:16                                                     ` Pip Cet
2020-03-14 15:34                                                       ` Pip Cet
2020-03-13 17:42                                             ` Pieter van Oostrum
2020-03-13 19:34                                               ` Eli Zaretskii
2020-03-13 21:35                                                 ` Pieter van Oostrum
2020-03-14  8:08                                                   ` Eli Zaretskii
2020-03-14 21:32                                                     ` Pieter van Oostrum
2020-03-15 19:49                                                       ` Pieter van Oostrum
2020-03-15 19:57                                                         ` Eli Zaretskii
2020-03-15 23:26                                                           ` Pieter van Oostrum
2020-03-16 10:44                                                             ` Pieter van Oostrum
2020-03-16 15:07                                                               ` Eli Zaretskii
2020-03-16 15:33                                                               ` Pip Cet
2020-03-16 17:19                                                                 ` Pip Cet
2020-03-17  3:29                                                                   ` Pieter van Oostrum
2020-03-17  4:54                                                                     ` Pip Cet
2020-03-17  5:20                                                                       ` Pip Cet
2020-03-17  8:45                                                                         ` Pieter van Oostrum
2020-03-17 13:54                                                                           ` Pip Cet
2020-03-17 15:27                                                                             ` Pieter van Oostrum
2020-03-17 20:16                                                                               ` Pip Cet
2020-03-17 23:32                                                                                 ` Pieter van Oostrum
2020-03-18 15:05                                                                                   ` Eli Zaretskii
2020-03-19 13:23                                                                                     ` Pieter van Oostrum
2020-03-19 13:57                                                                                       ` Pip Cet
2020-03-21 21:22                                                                                         ` Pieter van Oostrum
2020-03-22 14:21                                                                                           ` Eli Zaretskii
2020-03-22 15:48                                                                                           ` Pip Cet
2020-03-23 19:34                                                                                             ` Pip Cet
2020-03-17  8:40                                                                       ` Pieter van Oostrum
2020-03-17 15:33                                                                     ` Eli Zaretskii
2020-03-17 20:59                                                                       ` Paul Eggert
2020-03-18  6:17                                                                         ` Pip Cet
2020-03-18  9:22                                                                           ` Robert Pluim
2020-03-18 11:38                                                                             ` Pieter van Oostrum
2020-03-18 11:57                                                                               ` Paul Eggert
2020-03-18 14:08                                                                               ` Pip Cet
2020-03-19 19:17                                                                                 ` Pieter van Oostrum
2020-03-19 19:31                                                                                   ` Pip Cet
2020-03-19 21:30                                                                                     ` Pieter van Oostrum
2020-03-18 14:08                                                                           ` Eli Zaretskii
2020-03-16 18:36                                                                 ` Pieter van Oostrum
2020-03-13  7:58                                         ` Eli Zaretskii
2020-03-10 15:10                         ` Eli Zaretskii
2020-03-10 18:23                           ` Pieter van Oostrum
2020-03-11  8:22                         ` Paul Eggert
2022-04-30 12:38 ` Lars Ingebrigtsen
2022-05-29 13:19   ` Lars Ingebrigtsen

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=CAOqdjBdscissdCY8V0NHnkZeydNJJn-XEZoyTbMm2gzFvTTkKA@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=39962@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=pieter-l@vanoostrum.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.