#4533: IO manager can leak MVars if threads are killed
---------------------------------+------------------------------------------
Reporter: bos | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
---------------------------------+------------------------------------------
Comment(by bos):
Spent a few more hours on this, but don't have working code to show for
it.
Currently, it looks to me like the weak reference ''must'' live out in
{{{System.Event.Thread}}} if we want to retain the current APIs, which is
less than ideal from an encapsulation standpoint.
So {{{threadWait}}} creates an empty {{{MVar}}}, then hands the IO manager
a callback that has a reference to the {{{MVar}}}, while the caller blocks
using a {{{takeMVar}}}. In order for the {{{MVar}}} to be garbage
collected if the caller is killed, the callback ''must'' hold only a weak
reference to the {{{MVar}}}. The earlier example code was never going to
work, in other words, because I wasn't thinking about it correctly.
I have some test code which does this, but it's more complicated than I'd
like. Oh, and it doesn't work. I'll attach it anyway, though I'm not sure
I'd recommend reading it :-(
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4533#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs