windows-only: sdl2-mixer postmix callback crashes during GC

Bug #1827946 reported by Andrew Kent on 2019-05-06
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

# Description and Test-case
Note: I've only been able to cause this crash on windows.

It seems as though if a cffi-callback is active during garbage collection, sbcl will crash (or drop into ldb).

See example here: https://gitlab.com/_ark_/garbagecrash

Commenting out the `sb-ext:gc` funcall prevents the crash.

Unfortunately I wasn't able to reproduce this without SDL2-mixer (presumably it's doing something more complicated than my toy callback code was).

# SBCL Version
./bin/sbcl.exe --version
SBCL 1.4.14

# Features

*features*
(:SWANK :QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-WINDOWS
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ROS.INIT :X86-64 :64-BIT
 :64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :C-STACK-IS-CONTROL-STACK
 :CALL-SYMBOL :COMMON-LISP :COMPARE-AND-SWAP-VOPS :CYCLE-COUNTER
 :FLOAT-EQL-VOPS :FP-AND-PC-STANDARD-SAVE :GENCGC :IEEE-FLOATING-POINT
 :INTEGER-EQL-VOP :LINKAGE-TABLE :LITTLE-ENDIAN :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-PUTWC :PACKAGE-LOCAL-NICKNAMES :SB-DOC :SB-DYNAMIC-CORE :SB-EVAL
 :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-QSHOW :SB-SAFEPOINT
 :SB-SAFEPOINT-STRICTLY :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-THREAD
 :SB-THRUPTION :SB-UNICODE :SB-WTIMER :SBCL :STACK-ALLOCATABLE-CLOSURES
 :STACK-ALLOCATABLE-FIXED-OBJECTS :STACK-ALLOCATABLE-LISTS
 :STACK-ALLOCATABLE-VECTORS :STACK-GROWS-DOWNWARD-NOT-UPWARD
 :UNDEFINED-FUN-RESTARTS :UNWIND-TO-FRAME-AND-CALL-VOP :WIN32)

Stas Boukarev (stassats) wrote :

What does it say after entering ldb?

Andrew Kent (realark) wrote :

* (run-crash-demo)
main thread: Starting main lisp on thread
main thread: Wait on sem #S(SB-THREAD:SEMAPHORE
                            :NAME NIL
                            :%COUNT 0
                            :WAITCOUNT 0
                            :MUTEX #<MUTEX "semaphore lock" (free)>
                            :QUEUE #<WAITQUEUE {10036D3F03}>).
foreign callback : in callback waiting on mutex
main thread: Doing a full GC.
fatal error encountered in SBCL pid 8504(tid 00000000010D18C0):
thread 00000000050D2000: bogus esp: 0000000000C5F2B0

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb>

Andrew Kent (realark) wrote :

Let me know if there's any command I can run in ldb to help. LDB is dark magic to me so detailed instructions are appreciated.

Andrew Kent (realark) on 2019-05-16
description: updated
Stas Boukarev (stassats) wrote :

6676d72b7fc38d61d93af5d2898f8175e0ac1fb7

Changed in sbcl:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers