Re: master: Stop finalizer in S-L-A-D only if no other threads exist
Stas Boukarev <[email protected]> Tue, 17 Feb 2026 19:12:19 +0300
| Newsgroups | gmane.lisp.steel-bank.cvs,gmane.lisp.steel-bank.devel |
|---|---|
| Message-ID | <CAF63=111F+AyCdDph_8GRKw8wGBdYPR5mB0xP+FVTUEMpxDqWg@mail.gmail.com> |
On windows save7 fails with:
(and after adding
(format t "~a ~a ~a~%" threads starting joinable))
(#<THREAD tid=4240 "main thread" RUNNING {10020B0003}>) (#<THREAD
tid=0 "finalizer" RUNNING {1002060363}>) NIL
Unhandled SB-IMPL::SAVE-WITH-MULTIPLE-THREADS-ERROR in thread
#<SB-THREAD:THREAD tid=4240 "main thread" RUNNING
{10020B0003}>:
Cannot save core with multiple threads running.
Interactive thread (of current session):
#<THREAD tid=4240 "main thread" RUNNING {10020B0003}>
Other thread:
0
On Tue, Feb 17, 2026 at 6:11 PM snuglas via Sbcl-commits
<[email protected]> wrote:
>
> The branch "master" has been updated in SBCL:
> via 55c0f2e12ab0bc9d1b11a50f4c9d20162740ba83 (commit)
> from 49044888b298a1ace613a918cdbd4b6ad5bfd586 (commit)
>
> - Log -----------------------------------------------------------------
> commit 55c0f2e12ab0bc9d1b11a50f4c9d20162740ba83
> Author: Douglas Katzman <[email protected]>
> Date: Tue Feb 17 10:10:56 2026 -0500
>
> Stop finalizer in S-L-A-D only if no other threads exist
> ---
> src/code/save.lisp | 16 ++++++++--------
> tests/save.impure.lisp | 11 +++++++++++
> 2 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/src/code/save.lisp b/src/code/save.lisp
> index 8db5f7e4a..977a3da5f 100644
> --- a/src/code/save.lisp
> +++ b/src/code/save.lisp
> @@ -324,20 +324,20 @@ sufficiently motivated to do lengthy fixes."
> #+sb-thread
> (let (error)
> (with-system-mutex (sb-thread::*make-thread-lock*)
> - (finalizer-thread-stop)
> (sb-thread::%dispose-thread-structs)
> (let ((threads (sb-thread:list-all-threads))
> (starting
> (setq sb-thread::*starting-threads* ; ordinarily pruned in MAKE-THREAD
> (delete 0 sb-thread::*starting-threads*)))
> (joinable sb-thread::*joinable-threads*))
> - (when (or (cdr threads) starting joinable)
> - (let* ((interactive (sb-thread::interactive-threads))
> - (other (union (set-difference threads interactive)
> - (union starting joinable))))
> - (setf error (make-condition 'save-with-multiple-threads-error
> - :interactive-threads interactive
> - :other-threads other))))))
> + (if (or (cdr threads) starting joinable)
> + (let* ((interactive (sb-thread::interactive-threads))
> + (other (union (set-difference threads interactive)
> + (union starting joinable))))
> + (setf error (make-condition 'save-with-multiple-threads-error
> + :interactive-threads interactive
> + :other-threads other)))
> + (finalizer-thread-stop))))
> (when error (error error))
> #+allocator-metrics (setq sb-thread::*allocator-metrics* nil)
> (setq sb-thread::*sprof-data* nil))
> diff --git a/tests/save.impure.lisp b/tests/save.impure.lisp
> index 364451ce6..1635e31be 100644
> --- a/tests/save.impure.lisp
> +++ b/tests/save.impure.lisp
> @@ -27,3 +27,14 @@
> (setf donep t)
> (sb-thread:condition-notify cvar))
> (sb-thread:join-thread thread)))
> +
> +(with-test (:name (sb-ext:save-lisp-and-die error :multiple-threads-2))
> + (let* ((sem (sb-thread:make-semaphore))
> + (thread (sb-thread:make-thread
> + (lambda () (sb-thread:wait-on-semaphore sem)))))
> + (assert (eq (handler-case (save-lisp-and-die "expect_failure")
> + (sb-impl::save-with-multiple-threads-error () 'ok))
> + 'ok))
> + (assert (sb-thread::thread-p sb-impl::*finalizer-thread*))
> + (sb-thread:signal-semaphore sem)
> + (sb-thread:join-thread thread)))
>
> -----------------------------------------------------------------------
>
>
> hooks/post-receive
> --
> SBCL
>
>
> _______________________________________________
> Sbcl-commits mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-commits
_______________________________________________
Sbcl-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-commits