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

MVar deadlock when using Literate Haskell and multiple capabilities #73

snoyberg opened this issue Jul 28, 2014 · 5 comments

Comments

@snoyberg
Copy link
Contributor

@snoyberg snoyberg commented Jul 28, 2014

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

This comment has been minimized.

Copy link
Owner

@ndmitchell ndmitchell commented Jul 28, 2014

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

ndmitchell added a commit that referenced this issue Jul 28, 2014
@ndmitchell

This comment has been minimized.

Copy link
Owner

@ndmitchell ndmitchell commented Jul 28, 2014

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

This comment has been minimized.

Copy link
Contributor Author

@snoyberg snoyberg commented Jul 29, 2014

Awesome, thanks!

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

@snoyberg snoyberg closed this Jul 29, 2014
@ndmitchell

This comment has been minimized.

Copy link
Owner

@ndmitchell ndmitchell commented Jul 29, 2014

Yep, I will be.

@snoyberg

This comment has been minimized.

Copy link
Contributor Author

@snoyberg snoyberg commented Jul 29, 2014

Cool, I'll see you there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.