[slime-devel] sbcl stream flushing race

Robert J. Macomber slime at rojoma.com
Wed Mar 29 03:05:58 UTC 2006


After some time, I've finally got annoyed by the SBCL output race
buglet to do something about it.

For those who haven't seen this (either because you don't use sbcl, or
your systems aren't the "right" speed to trigger it), sometimes when
outputting to the dedicated output stream, multiple flushes will be
done to aren't the "right" speed to trigger it), sometimes when
outputting to the dedicated output stream, multiple flushes will be
done at the same time, resulting in something that looks like this
paragraph.

I have a patch that fixes it, but it's a bit of a blunt instrument.
It wraps the streams passed to MAKE-STREAM-INTERACTIVE in a Gray
stream containing a mutex, so that the stream acts as a monitor,
preventing different threads from using it at the same time.  (This
changes the semantics of the make-stream-interactive interface; before
it was called for side-effects, now it may or may not have a side
effect and returns an "interactive" stream that may or may not be the
same object as the one it was called with.  All the swank backends are
updated in the patch.)

Currently, the patch is sbcl-only.  While updating the other backends,
I noticed abcl uses the same "thread which FORCE-OUTPUTs" technique,
but I don't have abcl here, so I don't know if the same race
manifests, if abcl even supports Gray strams, or how to create and use
a mutex if the two previous conditions held.

Is there any interest in this, or does anyone have a better idea how
to approach this bug?
-- 
Robert Macomber
slime at rojoma.com / Thas on #lisp



More information about the slime-devel mailing list