dx-let in with-deadline causes memory faults
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
We're running into memory errors while printing thread objects that are/were waiting on a mutex while a deadline is active.
Because with-deadline uses a dynamic-extent declaration on the deadline itself, we seem to be starting to print the thread while the deadline is part of the thread-waiting-for cons, and by the time we go to print the thread-waiting-for slot, the deadline object no longer exists, causing a memory error.
Running the following function reproduces this.
(defun bug ()
(let ((mutex (sb-thread:
wait)
(sb-
(let ((thread (sb-thread:
(sleep 1.0)
(setf wait (sb-thread:
(sleep 1.0)
(
(sleep 10)
wait)))
Expected result:
(#S(SB-
. #<SB-THREAD:MUTEX free owner=0 {1007D08563}>)
Actual Result:
CORRUPTION WARNING in SBCL pid 3713 tid 3713:
Memory fault at 0x7f1b (pc=0x52ca29b6 [code 0x52ca2800+0x1B6 ID 0x40ce], fp=0x7f06eafdf658, sp=0x7f06eafdf648) tid 3713
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
debugger invoked on a SB-SYS:
#<THREAD tid=3713 "main thread" RUNNING {10011A8003}>:
Unhandled memory fault at #x7F1B.
Changing with-deadline to use let instead of dx-let on the deadline object seems to fix the issue.
Environment stuff:
sbcl --version
> SBCL 2.3.3
and
> SBCL 2.3.6.68-
*features*
(:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
:NON-BASE-
:ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-
:PACKAGE-
:SBCL :UNIX)
uname -a
Linux jconnor-
Changed in sbcl: | |
status: | New → Incomplete |
Changed in sbcl: | |
status: | Confirmed → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
I'm don't understand your examples, why does it use sb-thread: :thread- waiting- for?