non-abortable call stack exhaustion on recursive class

Bug #1418883 reported by Lucien Pullen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Jan Moringen

Bug Description

When defining a class that has itself in the class precedence list, the call stack is exhausted in SB-PCL::UPDATE-CLASS. This exhaustion is non-abortable... calling the ABORT restart results in the error appearing again, and eventually a memory corruption warning. This is present for both immediate parent classes and parent classes of parent classes.

The most simple test case is here:

* (defclass my-class (my-class) ())
=> #<STANDARD-CLASS MY-CLASS>
* (defclass my-class (my-class) ())
; error ad nauseum

A more reasonable test case is here:

* (defclass foo (bar) ())
=> #<STANDARD-CLASS FOO>
* (defclass bar (foo) ())
; error ad nauseum

An error is eventually signaled, but there is no meaningful restart. Attached is a patch that causes the circularity to be caught and able to be ABORT'd from. There is a test case for both direct and arbitrary superclasses. The first (a quick sanity check of direct superclasses) will fail, since I'm not sure about the implementation for the check. I'm guessing it should go somewhere in SB-MOP:ENSURE-CLASS(-USING-CLASS).

version := sbcl-1.2.8-16-gc12b725

uname -a := Darwin lucien-laptoop 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64

features := (CFFI-FEATURES:FLAT-NAMESPACE CFFI-FEATURES:X86-64 CFFI-FEATURES:UNIX
 CFFI-FEATURES:DARWIN :CFFI CFFI-SYS::FLAT-NAMESPACE :CL-UNICODE :CL-PPCRE
 :QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX
 :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ALIEN-CALLBACKS :ANSI-CL
 :ASH-RIGHT-VOPS :BSD :C-STACK-IS-CONTROL-STACK :COMMON-LISP
 :COMPARE-AND-SWAP-VOPS :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :DARWIN
 :DARWIN9-OR-BETTER :FLOAT-EQL-VOPS :GENCGC :IEEE-FLOATING-POINT
 :INLINE-CONSTANTS :INODE64 :INTEGER-EQL-VOP :INTERLEAVED-RAW-SLOTS
 :LINKAGE-TABLE :LITTLE-ENDIAN :MACH-EXCEPTION-HANDLER :MACH-O
 :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :OS-PROVIDES-PUTWC
 :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :PRECISE-ARG-COUNT-ERROR
 :RAW-INSTANCE-INIT-VOPS :SB-DOC :SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS
 :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-TEST :SB-UNICODE :SBCL
 :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UD2-BREAKPOINTS :UNIX
 :UNWIND-TO-FRAME-AND-CALL-VOP :X86-64)

Tags: review
Revision history for this message
Lucien Pullen (drurowin) wrote :
Revision history for this message
Attila Lendvai (attila-lendvai) wrote :

interestingly enough in slime i cannot reproduce this. i keep pressing 'q' in the debugger and after a few presses it just quits back to the repl without entering LDB.

the same SBCL version in the terminal dies.

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Confirmed
Jan Moringen (scymtym)
Changed in sbcl:
assignee: nobody → Jan Moringen (scymtym)
Jan Moringen (scymtym)
Changed in sbcl:
status: Confirmed → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.