[plt-scheme] problem with weak hash tables?

From: Doug Orleans (dougo at place.org)
Date: Sun May 8 18:46:34 EDT 2005

I'm running into a bug that I think has to do with weak hash tables.
The symptom seems to be that a value is being dropped from a weak hash
table when its key is still reachable.  This is not consistently
reproducible-- it only happens once every ten times or so running my
test program, and each run makes several thousand references to weak
hash tables.  The tables use eq, not equal, and I am not mutating the
keys, which are regular structure instances.  My program has no other
sources of non-determinism that I'm aware of; it's single-threaded and
doesn't use I/O.  I am using parameters and call-with-parameterization,
though.  I can't seem to make it happen more repeatably by explicitly
calling `collect-garbage' in between table accesses-- in fact I
haven't been able to reproduce the bug at all when I do that, but it
runs slower that way so I haven't been doing it as much.

Anyway, is it possible that this is a bug in the garbage collector or
something else relating to weak hash tables?  I'm really at a loss to
figure out how else to explain this behavior, or even what I can do to
better isolate the problem.  Any advice would be appreciated.

--dougo at place.org

P.S. I'm using MzScheme v299.101 built from CVS on Linux.



Posted on the users mailing list.