GNU bug report logs - #37892
27.0.50; Crash when signaling a thread

Previous Next

Package: emacs;

Reported by: Michał Krzywkowski <mkrzywkow <at> gmail.com>

Date: Wed, 23 Oct 2019 17:08:02 UTC

Severity: normal

Found in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michał Krzywkowski <mkrzywkow <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 37892 <at> debbugs.gnu.org, Michał Krzywkowski <mkrzywkow <at> gmail.com>
Subject: bug#37892: 27.0.50; Crash when signaling a thread
Date: Sun, 27 Oct 2019 20:26:43 +0100
[Message part 1 (text/plain, inline)]
>>>>> "Eli" == Eli Zaretskii <eliz <at> gnu.org> writes:
    Eli> But thread-signal is not for causing an error in a thread, it is for
    Eli> unblocking a thread that waits on a mutex or a condvar.  So why would
    Eli> you use it when the thread is not blocked?
    >>
    >> Then I think documentation for that function should be changed to
    >> explicitly say that the signal will *only* be delivered if the target
    >> thread is in a "blocked call to ‘mutex-lock’, ‘condition-wait’, or
    >> ‘thread-join’".
    >>
    >> Currently, the docstring of thread-signal just says that the function
    >> will interrupt threads which are blocked, but does not actually say that
    >> the signal will be delivered only in those cases.  In fact, it says that
    >> it works like signal, so I don't think it's unreasonable to assume that
    >> it will just interrupt a thread whatever it's doing.

    Eli> The function does work like a signal, but Emacs cannot be interrupted
    Eli> while it waits for input.  In all other cases your signal will be
    Eli> delivered, and if unhandled, it will terminate the thread.

    Eli> If we decide that thread-signal will have no effect while a thread
    Eli> waits for input, then we will document that, of course.  My question
    Eli> was meant to understand your intent for signaling a thread at
    Eli> arbitrary time, because the effect of that is unpredictable, even if
    Eli> the crash didn't happen.  I wanted to understand your thinking and
    Eli> rationale, so as to have a better basis for the decision of how to fix
    Eli> this problem.

    Eli> So could you please elaborate on your rationale?

Actually there is no deeper reason behind it.  I was just testing
threads in Emacs, seeing how things behave.  I certainly would think
twice before writing code that interrupts a thread at an arbitrary point
in a real program.

When it comes to sit-for, I use it sometimes.  Is there a reason not to
use it in threads?

In any case, I'm not encouraging anyone to program like that, I'm just
reporting a crash...

--
Michał Krzywkowski
PGP: A5A7 06C4 28EF 8F64 2868 13A1 7BDE C129 F0B8 09A1
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 3 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.