From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: pipcet@gmail.com, 21380@debbugs.gnu.org
Subject: bug#21380: 25.0.50; GTK-induced segfault when scheduling timer from window-configuration-change-hook
Date: Sat, 05 Sep 2015 10:38:53 +0300 [thread overview]
Message-ID: <83a8t18gdu.fsf@gnu.org> (raw)
In-Reply-To: <jwv1tefo7ic.fsf-monnier+emacsbugs@gnu.org>
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: Eli Zaretskii <eliz@gnu.org>, Pip Cet <pipcet@gmail.com>,
> 21380@debbugs.gnu.org
> Date: Thu, 03 Sep 2015 11:36:44 -0400
>
> >> So maybe we should introduce a special copy_sequence_no_quit function
> >> that never calls QUIT, and then use it for copying the timer lists.
>
> That'd be OK, yes.
I believe the currently preferred solution is to block input and
atimers while copying the timer lists to local copies. Are you okay
with that?
> This said, maybe an even better solution would be to avoid the copy
> altogether.
>
> AFAICT these lists are only ever side-effected by timer.el's
> timer--activate, which has a special `reuse-cell' argument just to be
> able to do that.
>
> I'm not completely sure why we do it this way, but my naive
> understanding is the following:
> - For historical reasons of limited resources, timer.el tries hard to
> avoid allocating cons cells.
> - Then many years later we found a problem with this cell-reuse and
> circumvented it by copying the whole list all the time.
> - So we end up working hard to avoid allocating a couple cells on one
> side, only to end up allocating many more on the other.
>
> Maybe we should go back to bugs #12447 and #12326 and see if just
> removing the "reuse-cell" code (and the Fcopy_sequence(s)) fixes the
> problem as well.
I'm not sure I understand this plan. Are you saying that consing a
new list in timer--activate, instead of reusing an existing cell, will
avoid the need to wok on a copy of the timer's list when invoking the
timer callbacks? If so, I'm probably missing something here, because
timer--activate will update the timer list variable anyway, and we
have the same problem, whereby the list changes under our feet, back
again.
IOW, if some Lisp run by a timer callback ends up doing (directly or
indirectly) something like
(setq timer-list (cons my-new-timer timer-list))
doesn't it mean the value of Vtimer_list in C seen by timer_check
changes as well that very moment?
Not to mention the fact that with timers firing every several tens of
ms, something we've seen while discussing these bugs, allocating a
couple of cells each time might cause a lot of consing per second,
which in turn causes GC, which slows down everything.
next prev parent reply other threads:[~2015-09-05 7:38 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-30 12:51 bug#21380: 25.0.50; GTK-induced segfault when scheduling timer from window-configuration-change-hook Pip Cet
2015-08-30 15:01 ` Eli Zaretskii
2015-08-30 15:24 ` Pip Cet
2015-08-30 15:27 ` Pip Cet
2015-08-30 16:24 ` Pip Cet
2015-08-30 18:10 ` martin rudalics
2015-08-30 18:20 ` Pip Cet
2015-08-30 19:50 ` Eli Zaretskii
2015-08-30 18:59 ` Pip Cet
2015-08-31 9:20 ` martin rudalics
2015-08-30 16:39 ` Eli Zaretskii
2015-08-30 16:42 ` Pip Cet
2015-08-30 19:44 ` Eli Zaretskii
2015-08-30 20:56 ` Pip Cet
2015-08-30 21:13 ` Pip Cet
2015-08-31 14:31 ` Eli Zaretskii
2015-09-01 10:20 ` Pip Cet
2015-09-01 15:03 ` Eli Zaretskii
2015-09-01 15:22 ` Pip Cet
2015-09-01 16:01 ` Eli Zaretskii
2015-09-01 16:02 ` Pip Cet
2015-09-01 16:23 ` Eli Zaretskii
2015-09-02 7:02 ` martin rudalics
2015-09-02 14:32 ` Eli Zaretskii
2015-09-03 15:36 ` Stefan Monnier
2015-09-05 7:38 ` Eli Zaretskii [this message]
2015-09-05 15:18 ` Stefan Monnier
2015-09-05 15:27 ` Eli Zaretskii
2015-09-06 22:11 ` Stefan Monnier
2022-04-29 12:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-29 13:40 ` Eli Zaretskii
2022-04-29 13:44 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-29 15:02 ` Pip Cet
2015-09-05 16:59 ` Pip Cet
2015-09-06 22:22 ` Stefan Monnier
2015-09-08 15:55 ` Pip Cet
2015-09-01 15:14 ` Pip Cet
2015-09-01 16:04 ` Eli Zaretskii
2015-09-01 16:56 ` Pip Cet
2015-09-01 17:19 ` Eli Zaretskii
2015-09-01 20:48 ` Pip Cet
2015-09-02 15:08 ` Eli Zaretskii
2015-09-02 16:09 ` Pip Cet
2015-09-02 19:13 ` Eli Zaretskii
2015-09-02 22:08 ` Pip Cet
2020-09-07 17:07 ` Lars Ingebrigtsen
2020-09-07 17:47 ` Pip Cet
2020-09-07 19:09 ` Eli Zaretskii
2020-09-08 9:57 ` Lars Ingebrigtsen
2022-04-29 12:14 ` 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=83a8t18gdu.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=21380@debbugs.gnu.org \
--cc=monnier@IRO.UMontreal.CA \
--cc=pipcet@gmail.com \
/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.