save-lisp-and-die on sbcl.core breaks some tests

Bug #1964511 reported by Sébastien Villemot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

In the Debian package, we do the following at build time in order to set the source location to the system-wide one:

HOME=$(pwd) src/runtime/sbcl --core output/sbcl.core --no-sysinit --no-userinit \
             --eval '(sb-ext:set-sbcl-source-location "/usr/share/sbcl-source/")' \
             --eval '(sb-ext:save-lisp-and-die "output/sbcl.core")'

Then we run the testsuite, and since 2.2.2 it fails in the “pure” tests with:

Unhandled SIMPLE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                    {1001810073}>:
  Symbol value differs: SB-IMPL::**FINALIZER-STORE**

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001810073}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SIMPLE-ERROR "Symbol value differs: ~S" {10048C53F3}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<SIMPLE-ERROR "Symbol value differs: ~S" {10048C53F3}>)
2: (INVOKE-DEBUGGER #<SIMPLE-ERROR "Symbol value differs: ~S" {10048C53F3}>)
3: (ERROR "Symbol value differs: ~S" SB-IMPL::**FINALIZER-STORE**)
4: (RUN-TESTS::COMPARE-SYMBOL-VALUES ((SB-ALIEN::*ALIEN-CALLABLES* . #<HASH-TABLE :TEST EQ :COUNT 0 {10009E94C3}>) (SB-ALIEN::*ALIEN-FUN-TYPE-VARARGS-DEFAULT* . :UNSPECIFIED) (SB-ALIEN::*ALIEN-CALLBACK-TRAMPOLINES* . #()) (SB-ALIEN::*SHARED-OBJECTS-LOCK* . #<SB-THREAD:MUTEX "shared object list lock" (free)>) (SB-ALIEN::*ALIEN-TYPE-CLASSES* . #<HASH-TABLE :TEST EQL :COUNT 16 {10000196A3}>) (SB-ALIEN::*ALIEN-CALLBACK-INFO*) (SB-ALIEN::*ALIEN-CALLBACKS* . #<HASH-TABLE :TEST EQUAL :COUNT 0 {10009E9303}>) (SB-ALIEN::*ALIEN-CALLBACK-WRAPPERS* . #<HASH-TABLE :TEST EQUAL :COUNT 0 {10009E9403}>) (SB-ALIEN::*ALIEN-TYPE-MATCHES*) (SB-ALIEN::*NEW-AUXILIARY-TYPES*) (SB-REGALLOC:*PACK-OPTIMIZE-SAVES* . T) (SB-REGALLOC:*PACK-ASSIGN-COSTS* . T) ...))
5: (RUN-TESTS::PURE-RUNNER (#P"/tmp/sbcl-2.2.2/tests/allocator.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/arith-2.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/arith-slow.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/arith.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/array.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/assembler.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/avltree.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/backq.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/bad-code.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/bit-bash.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/bivalent-stream.pure.lisp" #P"/tmp/sbcl-2.2.2/tests/bug-1072739.pure.lisp" ...) RUN-TESTS::LOAD-TEST #<SB-SYS:FD-STREAM for "file /tmp/sbcl-2.2.2/tests/test.log" {1003875FA3}>)
6: (RUN-TESTS::RUN-ALL)
7: (SB-INT:SIMPLE-EVAL-IN-LEXENV (RUN-TESTS::RUN-ALL) #<NULL-LEXENV>)
8: (EVAL (RUN-TESTS::RUN-ALL))
9: (SB-IMPL::PROCESS-EVAL/LOAD-OPTIONS ((:EVAL . "(setf sb-ext:*evaluator-mode* :compile)") (:EVAL . "(with-compilation-unit () (load \"run-tests.lisp\"))") (:EVAL . "(run-tests::run-all)")))
10: (SB-IMPL::TOPLEVEL-INIT)
11: ((FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP))
12: ((FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-IMPL::START-LISP))
13: (SB-IMPL::START-LISP)

I have verified that the crash of the testsuite is related to the save-lisp-and-die command above.

Also, the problem was not present in 2.1.11 (so it was introduced in the 2.2 series, I did not check in which version exactly).

Do you consider this as a bug? Or should I change the procedure for setting the source location, and if yes, how?

Thanks for your work,

S. Villemot

Revision history for this message
Kambiz Darabi (darabi) wrote :

I tried a build without

--eval '(sb-ext:set-sbcl-source-location "/usr/share/sbcl-source/")'

and get the same result.

Reducing the number of tests to these:

- compiler.pure.lisp
- compound-cons.pure.lisp
- condition-2.pure.lisp

triggers the error reproducibly. Running the last two does not lead
to an error.

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 1964511] Re: save-lisp-and-die on sbcl.core breaks some tests

I'm not sure, but I think that a change in value of **FINALIZER-STORE**
when running "pure" tests is not completely unexpected; it's possible
that the consistency tester for running the tests (which is what this
is) is being too strong in its assertions.

The finalizer store can run out of room, a new one allocated and
assigned (copying old values across). I think it's a bit surprising
that that would happen to a freshly-saved core differently from the core
saved from the build process, but...

Revision history for this message
Douglas Katzman (dougk) wrote :

I'll add finalizer-store to the list of ignorable symbols.

Revision history for this message
Kambiz Darabi (darabi) wrote :

This is reproducible with the sbcl-2.2.2 tarball with these steps:

sh make.sh --fancy
src/runtime/sbcl --core output/sbcl.core --no-sysinit --no-userinit --eval '(sb-ext:save-lisp-and-die "output/sbcl.core")'
cd tests
./run-tests.sh compiler.pure.lisp compound-cons.pure.lisp condition-2.pure.lisp

on two different systems

$ uname -a
Linux myserver 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

and

$ uname -a
Linux mylaptop 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:02:41 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

Revision history for this message
Kambiz Darabi (darabi) wrote :

As discussed on IRC [1], the failure is due to too strict consistency checks for side effects during the 'pure' tests.

I will add a patch to the Debian packaging to ignore the modified SB-IMPL::**FINALIZER-STORE**

[1] https://irclog.tymoon.eu/libera/%23sbcl?around=1648544051#1648544051

Douglas Katzman (dougk)
Changed in sbcl:
status: New → Fix Committed
Revision history for this message
Christophe Rhodes (csr21-cantab) wrote :

I believe this was fixed in sbcl-2.2.4

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.