Error when interactive threads list is empty
In toplevel REPL, run this code and type 0 (continue) in the debugger (run in thread 2) before 10 seconds :
;; Create a new thread
;; Wait for the debugger to be called
;; Main thread releases foreground (and Thread 2 gets it, displaying debugger)
;; Type 0 (continue) to end Thread 2 while main thread is waiting
SBCL should return to REPL in main thread, then main thread sould call get-foreground et get foreground.
What happens : infinite loop displaying errors.
With Ctrl + S or recreating the error with Thread 2 by calling sb-thread:
Pushing main-thread in (sb-thread:
I don't understand from the backtrace where the error happens exactly but it seems that get-foreground don't like the list of interactive threads being empty.
what seems happening : the second thread gets foreground, main-thread releases foreground (release-foreground checks if there is something else in the list of interacive threads and yes : Thread 2 is in the list), then Thread 2 ends and there is nothing remaining in the list (the thread is probably removed from the list without being replaced by another one). Calling get-foreground at this time signals a type error somewhere (which is the main problem). Then debugger is called and calls get-foreground too, which signals a second error because of a non-recursive lock in get-foreground (this second problem is not the important one, but it generates an infinite error loop).
(is get-foreground intented to be used by user ? it is noted in SBCL manuel with release-foreground and seems useful but it is an internal symbol)
$ sbcl --version
$ uname -a
Linux yggdrasil 4.10.9-1-ARCH #1 SMP PREEMPT Sat Apr 8 12:39:59 CEST 2017 x86_64 GNU/Linux
(:64-BIT :64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS
:IMMOBILE-SPACE :INLINE-CONSTANTS :INTEGER-EQL-VOP :LARGEFILE :LINKAGE-TABLE
:LINUX :LITTLE-ENDIAN :MEMORY-
:SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-
:SB-THREAD :SB-UNICODE :SBCL :STACK-