[Haskell-cafe] Why don't my OS threads terminate?

Simon Marlow marlowsd at gmail.com
Thu Mar 10 18:11:21 CET 2011


On 28/02/11 15:59, Bas van Dijk wrote:
> On 25 February 2011 19:10, Bas van Dijk<v.dijk.bas at gmail.com>  wrote:
>> On 25 February 2011 18:27, sclv<s.clover at gmail.com>  wrote:
>>>
>>>
>>> Bas van Dijk-2 wrote:
>>>>
>>>> I believe the OS threads are created by my levmar library. This
>>>> library uses bindings-levmar[4] which is a binding to a C library.
>>>> bindings-levmar uses safe FFI calls because the levmar C procedures
>>>> are reentrant (they need to call back into Haskell to execute the
>>>> model function). I believe the RTS creates an OS thread for each safe
>>>> FFI call.
>>>>
>>>
>>> Sounds like #4262: http://hackage.haskell.org/trac/ghc/ticket/4262
>>>
>>> (Should be fixed in head)
>>
>> That looks exactly like my problem. I will try it out with ghc head on monday.
>
> In ghc-HEAD (7.1.20110227) the bug is fixed, great!
>
> The bug still appears in ghc-7.0.2-rc2, so I assume the patch in #4262
> was not merged in that release.
>
> Will it be merged into the upcoming ghc-7.0.2?

I'm slightly worried by this.  #4262 was not an OS thread "leak", but 
rather that when the program needs fewer OS threads we weren't returning 
the surplus OS threads back to the system.  #4262 doesn't make programs 
use an ever-increasing number of OS threads.  It's an optimisation 
rather than a bug, which is why we didn't merge the patch into the 7.0 
branch.

So I'm concerned because the symptom you describe sounds more like a 
leak. #4850 could have caused it, but the fix for that was merged into 
7.0.2.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list