[slime-devel] Bug report: error in process filter: destructure-case failed

Max Mikhanosha max at openchat.com
Fri Jul 14 17:35:39 UTC 2006

At Fri, 14 Jul 2006 15:36:07 +0200,

Helmut Eller wrote:

>My suspicion is that SBCL's printer is not thread-safe.  In
>particular, the use of sb-impl::*previous-case* looks like it could
>lead the kind of bugs that you see.

Yup SBCL bug, there is a bunch of special variables internal to
code/print.lisp, which are never bound when threads are started and as
such are shared between all threads.. Ie *internal-symbol-output-fun*
is global and is clobbered by every thread when *print-case* is
changed, so it always uses the value that was set by the last thread
which changed *print-case* to a different value.

Now that I've figured this out, I remember giving up playing with kpax
and portable-aserve, because of too many bugs where the case was bad
(it uses the :keyword for HTTP headers, and wrong case was popping up
all over the place). Now I think there is nothing wrong with
portable-aserve and kpax, but instead I was hitting the same bug.

--- SBCL test that (may only be failing on SMP hardware) ---
CL-USER> (let ((iterations 100000))
	   (sb-thread:make-thread (lambda () (let ((*print-case* :downcase))
					  (dotimes (i iterations) 
					    (assert (string= (with-output-to-string (s)
							       (prin1 'FOO s)) "foo")))w)))
	   (sb-thread:make-thread (lambda () (let ((*print-case* :upcase))
					  (dotimes (i iterations) 
					    (assert (string= (with-output-to-string (s)
							       (prin1 'FOO s)) "FOO"))))))
--- end ---


More information about the slime-devel mailing list