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: Sat, 26 Oct 2019 14:29:43 +0200
[Message part 1 (text/plain, inline)]
>>>>> "Eli" == Eli Zaretskii <eliz <at> gnu.org> writes:
    >> From: Michał Krzywkowski <mkrzywkow <at> gmail.com>

    >> Date: Wed, 23 Oct 2019 19:06:42 +0200
    >>
    >> When I evaluate this sexp, Emacs aborts:
    >>
    >> (let ((thread (make-thread (lambda () (sit-for 1.0)))))
    >> (sit-for 0.5)
    >> (thread-signal thread 'error nil))
    >>
    >> Backtrace:
    >>
    >> Thread 5 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig <at> entry=6, backtrace_limit=backtrace_limit <at> entry=40) at emacs.c:371
    >> 371       signal (sig, SIG_DFL);
    >> #0  0x000000000041f40b in terminate_due_to_signal (sig=sig <at> entry=6, backtrace_limit=backtrace_limit <at> entry=40) at emacs.c:371
    >> #1  0x000000000041f866 in emacs_abort () at sysdep.c:2450
    >> #2  0x000000000042154b in signal_or_quit (error_symbol=XIL(0x90), data=XIL(0), keyboard_quit=<optimized out>) at eval.c:1598
    >> #3  0x0000000000421564 in Fsignal (error_symbol=<optimized out>, data=<optimized out>) at eval.c:1568
    >> #4  0x0000000000423929 in post_acquire_global_lock (self=<optimized out>) at thread.c:115
    >> #5  0x00000000005c5e62 in acquire_global_lock (self=0x1465e50) at thread.c:123

    Eli> Emacs doesn't allow signals while it waits for input.

    Eli> We could ignore thread-signal in such cases, or we could make it an
    Eli> error (which will then signal an error in the thread which called
    Eli> thread-signal).  What do people think?  Are there any other ideas for
    Eli> handling this situation?

Maybe the signal should be raised in the thread right after it returns
from sit-for?  Ignoring signals sounds like a bad idea.

    Eli> Michał, can you tell why you needed to call thread-signal while the
    Eli> thread was in sit-for?

I wanted to signal some background thread which was doing some work and
then Emacs crashed, because it just so happened that it was in sit-for.
The thread function was doing _more_ than just sit-for.

I actually don't care (and can't know) what another thread is doing, I
just want to send a signal to it.

    Eli> Thanks.

Thank you.


--
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.