[Ironpython-users] _weakref.cs fixes
Kuno Meyer
kuno.meyer at gmx.ch
Mon May 4 13:13:17 CEST 2015
Dear all
I'd like to propose https://github.com/kunom/ipy-weakref (the ipy-27-maint
branch) to be included into the main IronPython code base. It fixes for me
various random SystemError and ValueError exceptions in the _weakref.cs module.
Please note that while my patch changes (and hopefully improves) some
aspects in _weakref.cs, I still do think that _weakref.cs has several
critical issues:
- There is absolutely no locking on the internal data structures, which
makes me think that there could be various runtime issues in a multithreaded
environment. (However, this does not directly apply to the Finalizer thread
since to my knowledge all user threads are suspended during finalization.)
- The weakref collection callback is invoked on the .NET finalizer thread. I
am not sure whether this is what user code expects. At least there is a high
potential of dead-locking the finalizer thread, which is not the nicest
thing to do. (Maybe we should issue a warning on direct calls to
GC.WaitForPendingFinalizers(), similar to what is printed when calling
Thread.Sleep().)
Other remarks:
- The weakref/weakrefset test case brought up in the mailing list on Apr 13
passes with my changes.
- The standard library weakref tests pass with the same number of failures
as before
- Please note that I am unexperienced with git/GitHub as well as with the
IronPython code base, so please show some patience...
Thanks!
Kuno
More information about the Ironpython-users
mailing list