Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVar deadlock when using Literate Haskell and multiple capabilities #73

Closed
snoyberg opened this issue Jul 28, 2014 · 5 comments
Closed

Comments

@snoyberg
Copy link
Contributor

Take two files, one an input file for hlint foo.lhs:

> main = return ()

And another program using the hlint library (hlint.hs):

import Language.Haskell.HLint
import Control.Exception

main = do
    x <- try $ hlint ["foo.lhs"] >> return ()
    putStrLn "after call to hlint"
    print (x :: Either SomeException ())
    putStrLn "after call to print"

Now try the following commands:

$ ghc --make -threaded -rtsopts hlint.hs
$ ./hlint
after call to hlint
Left In file foo.lhs at line 1: comment line before program line.

after call to print
$ ./hlint +RTS -N2
hlint: In file foo.lhs at line 1: comment line before program line.

after call to hlint
Left thread blocked indefinitely in an MVar operation
after call to print

Notice how the exception changes to thread blocked. This looks like some problematic parallelism.

@ndmitchell
Copy link
Owner

Thanks for the fantastic test case, certainly worthy of a beer when I eventually meet you. I'm taking a look now.

@ndmitchell
Copy link
Owner

Fixed - my parallelism function didn't deal with exceptions (it was written many years ago). I've released hlint-1.9.3 with the fix.

@snoyberg
Copy link
Contributor Author

Awesome, thanks!

By the way, are you going to be at ICFP by any chance?

@ndmitchell
Copy link
Owner

Yep, I will be.

@snoyberg
Copy link
Contributor Author

Cool, I'll see you there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants