
On 08/19/2012 12:58 PM, Iustin Pop wrote:
On more investigation, this seems to be due to the somewhat careless use of Foreign.Concurrent; from the docs:
“The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, and in fact there is no guarantee that the finalizer will eventually run at all.”
Also, see http://hackage.haskell.org/trac/ghc/ticket/1364.
So it seems that the intended way of cleaning up curl handles is all fine and dandy if one doesn't require timely cleanup; in most cases, this is not needed, but for cookies it is broken.
I don't know what the proper solution is; either way, it seems that there should be a way to force the cleanup to be run, via finalizeForeignPtr, or requiring full manual handling of curl handles (instead of via finalizers).
Gah, native libs++.
Wow, thanks for the in-depth analysis. I'll just switch to Network.Browser or its conduit counterpart.