Message11515
There's one more wrinkle here, which I thought about given Jeff's
observation that it doesn't occur at initialization, yet this looks
like a publishing problem to me. In running the test program of
msg11496, I tried the below change in PyType.java:
classToType = new MapMaker().weakKeys().weakValues().makeMap();
to
classToType = new MapMaker().makeMap();
and with that change, I'm not seeing the test program fail.
The weak references here are essential for Jython to be able to work
in the context of unloading corresponding Java classes and/or Python
types. But weak references of course do make it harder to think about
object lifetimes. For extra fun, I also threw in a gc.collect() in the
test program. With forced GC, that seemed to make it more reliable to
get the publishing failure using the current weak keys/values
construction, and at different times after startup. (Need to do this
testing more comprehensively to be sure, however.)
Note that we really don't care so much about it being weak keys/weak
values per se, only that it is possible to eventually do this cleanup
in some reasonable period of time. In other words, this should be a
cache. Right now, classToType doesn't appear to be caching terribly
well, given that we must be rebuilding these mappings despite being in
a tight inner loop.
More analysis required! |
|
Date |
User |
Action |
Args |
2017-07-31 17:49:14 | zyasoft | set | messageid: <1501523354.65.0.082092917062.issue2609@psf.upfronthosting.co.za> |
2017-07-31 17:49:14 | zyasoft | set | recipients:
+ zyasoft, jeff.allen, Ivan |
2017-07-31 17:49:14 | zyasoft | link | issue2609 messages |
2017-07-31 17:49:13 | zyasoft | create | |
|