GNU bug report logs - #25171
Error in thread causes Emacs to abort

Previous Next

Package: emacs;

Reported by: Andreas Schwab <schwab <at> linux-m68k.org>

Date: Sun, 11 Dec 2016 14:24:02 UTC

Severity: normal

Tags: fixed

Merged with 25164

Found in version 26.0.50

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25171 in the body.
You can then email your comments to 25171 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25171; Package emacs. (Sun, 11 Dec 2016 14:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Dec 2016 14:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Error in thread causes Emacs to abort
Date: Sun, 11 Dec 2016 15:23:15 +0100
When the function called by make-thread throws an error while Emacs is
reading from keyboard then it aborts in signal_or_quit because
waiting_for_input is non-zero.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25171; Package emacs. (Sun, 11 Dec 2016 16:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 25171 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>, Tom Tromey <tom <at> tromey.com>
Cc: 25171 <at> debbugs.gnu.org
Subject: Re: bug#25171: Error in thread causes Emacs to abort
Date: Sun, 11 Dec 2016 18:13:34 +0200
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Date: Sun, 11 Dec 2016 15:23:15 +0100
> 
> When the function called by make-thread throws an error while Emacs is
> reading from keyboard then it aborts in signal_or_quit because
> waiting_for_input is non-zero.

Right, thanks.

I think I fixed that now; the patch is below.

Tom, could you perhaps look at the patch and comment?  I'm puzzled why
you didn't do this in the first place, like you did with
waiting_for_user_input_p.  Are there any issues here that I'm missing?

TIA

diff --git a/src/keyboard.c b/src/keyboard.c
index 01b9b3c..cc78548 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -148,9 +148,6 @@ static Lisp_Object regular_top_level_message;
 
 static sys_jmp_buf getcjmp;
 
-/* True while doing kbd input.  */
-bool waiting_for_input;
-
 /* True while displaying for echoing.   Delays C-g throwing.  */
 
 static bool echoing;
@@ -322,10 +319,6 @@ static ptrdiff_t echo_length (void);
 /* Incremented whenever a timer is run.  */
 unsigned timers_run;
 
-/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
-   happens.  */
-struct timespec *input_available_clear_time;
-
 /* True means use SIGIO interrupts; false means use CBREAK mode.
    Default is true if INTERRUPT_INPUT is defined.  */
 bool interrupt_input;
diff --git a/src/keyboard.h b/src/keyboard.h
index a5ed5e1..5084c39 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -415,13 +415,6 @@ extern void unuse_menu_items (void);
 #define EVENT_HEAD_KIND(event_head) \
   (Fget ((event_head), Qevent_kind))
 
-/* True while doing kbd input.  */
-extern bool waiting_for_input;
-
-/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
-   happens.  */
-extern struct timespec *input_available_clear_time;
-
 extern bool ignore_mouse_drag_p;
 
 extern Lisp_Object parse_modifiers (Lisp_Object);
diff --git a/src/thread.h b/src/thread.h
index 6174032..f10824f 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -155,6 +155,15 @@ struct thread_state
   int m_waiting_for_user_input_p;
 #define waiting_for_user_input_p (current_thread->m_waiting_for_user_input_p)
 
+  /* True while doing kbd input.  */
+  bool m_waiting_for_input;
+#define waiting_for_input (current_thread->m_waiting_for_input)
+
+  /* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
+   happens.  */
+  struct timespec *m_input_available_clear_time;
+#define input_available_clear_time (current_thread->m_input_available_clear_time)
+
   /* The OS identifier for this thread.  */
   sys_thread_t thread_id;
 




Merged 25164 25171. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 11 Dec 2016 16:16:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25171; Package emacs. (Sun, 11 Dec 2016 17:43:01 GMT) Full text and rfc822 format available.

Message #13 received at 25171 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: schwab <at> linux-m68k.org
Cc: tom <at> tromey.com, 25171 <at> debbugs.gnu.org
Subject: Re: bug#25171: Error in thread causes Emacs to abort
Date: Sun, 11 Dec 2016 19:43:00 +0200
> Date: Sun, 11 Dec 2016 18:13:34 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 25171 <at> debbugs.gnu.org
> 
> diff --git a/src/keyboard.c b/src/keyboard.c
> index 01b9b3c..cc78548 100644
> --- a/src/keyboard.c
> +++ b/src/keyboard.c
> @@ -148,9 +148,6 @@ static Lisp_Object regular_top_level_message;
>  
>  static sys_jmp_buf getcjmp;
>  
> -/* True while doing kbd input.  */
> -bool waiting_for_input;
> -
>  /* True while displaying for echoing.   Delays C-g throwing.  */
>  
>  static bool echoing;
> @@ -322,10 +319,6 @@ static ptrdiff_t echo_length (void);
>  /* Incremented whenever a timer is run.  */
>  unsigned timers_run;
>  
> -/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
> -   happens.  */
> -struct timespec *input_available_clear_time;
> -

Actually, making input_available_clear_time thread-specific was a bad
idea (it causes current_thread dereferenced from a signal handler, and
current_thread could be NULL for short periods of time), so I undid it
in a followup commit.

The rest seems still valid.




Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 01 Nov 2017 20:27:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25171 <at> debbugs.gnu.org and Andreas Schwab <schwab <at> linux-m68k.org> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 01 Nov 2017 20:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Nov 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 261 days ago.

Previous Next


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