#5897: GHC runtime task workers are not released with C FFI
-------------------------------+--------------------------------------------
Reporter: sanketr | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.4.2
Component: Runtime System | Version: 7.4.1
Resolution: | Keywords: worker, ffi
Os: Unknown/Multiple | Architecture: x86_64 (amd64)
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related: #4262
-------------------------------+--------------------------------------------
Comment(by sanketr):
In case it is not clear right away from the code, here is the sequence of
execution from timerevent when forking FFI threads:
- timerevent forks sendSignal threads - it forks n threads corresponding
to n C FFI threads
- timerevent now waits on a list of mvar m2 - list has n elements, one
corresponding to each sendSignal thread
- each sendSignal thread calls back syncWithC function - puts an element
in m2, and waits on m1
- timerevent gets all m2, and puts 0 in list of m1
- Each syncWithC thread (which was called back by sendSignal) gets its
corresponding m1, and finishes. sendSignal is done. Those FFI threads are
now finished.
So, if sendSignal is finished (otherwise the code will deadlock if mvars
are not put/taken in right order), the number of worker threads shouldn't
keep increasing with each iteration of timerevent.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5897#comment:9>
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