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?
On Tue, 28 Mar 2006, Robert J. Macomber wrote:
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.
I don't remember seeing this with abcl. abcl doesn't have Gray streams, but SlimeInputStream/SlimeOutputStream tailor-made to make slime happy. I'd love to not having to change them :-) (I've completely forgotten what they do and how they do it!) but I don't want to stand in the way of progress.
Andras
On Wed, Mar 29, 2006 at 12:14:23PM +0200, Andras Simon wrote:
I don't remember seeing this with abcl. abcl doesn't have Gray streams, but SlimeInputStream/SlimeOutputStream tailor-made to make slime happy. I'd love to not having to change them :-) (I've completely forgotten what they do and how they do it!) but I don't want to stand in the way of progress.
Well, if abcl doesn't have the problem, nothing else need change there. The patch doesn't, as far as I know, break any other backends (my "updates" to them are simply having them return their argument).
Since there haven't been any horrified reactions to my description of the approach I took, here's the "cvs diff -u", and an additional file that actually implements the locked streams.
* Robert J. Macomber [2006-03-30 04:42+0200] writes:
Since there haven't been any horrified reactions to my description of the approach I took, here's the "cvs diff -u", and an additional file that actually implements the locked streams.
Wouldn't it be easier turn the dedicated stream off and add the neccessary locking to the stream in swank-gray.lisp?
On Thu, Mar 30, 2006 at 07:35:35AM +0200, Helmut Eller wrote:
Wouldn't it be easier turn the dedicated stream off and add the neccessary locking to the stream in swank-gray.lisp?
Errm. That hadn't actually occurred to me.
Patch attached. Not as thoroughly tested as the other, which I'd been using for a couple of days, but I haven't seen it behave badly yet.
"Robert J. Macomber" slime@rojoma.com writes:
Patch attached. Not as thoroughly tested as the other, which I'd been using for a couple of days, but I haven't seen it behave badly yet.
Since no-one seems to be objecting to this and the patch looks fine I've committed this.
Cheers,
-- Nikodemus Schemer: "Buddha is small, clean, and serious." Lispnik: "Buddha is big, has hairy armpits, and laughs."
On Wednesday 29 March 2006 05:05, Robert J. Macomber wrote:
After some time, I've finally got annoyed by the SBCL output race buglet to do something about it.
It has been getting on my nerves, too. One way to trigger it more easily is to have a huge repl buffer, say a million lines or so. On my system that slows things down enough that almost every printout from a background process is printed twice.
Gábor