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

Test suite hangs with ghc 8.4 (apparently due to hspec-2.5.0) #12

Closed
DanBurton opened this issue Mar 16, 2018 · 10 comments
Closed

Test suite hangs with ghc 8.4 (apparently due to hspec-2.5.0) #12

DanBurton opened this issue Mar 16, 2018 · 10 comments

Comments

@DanBurton
Copy link
Contributor

The last thing printed is:

Control.Exception.Enclosed
  catchAny
    catches exceptions thrown from the inside
    doesn't catch exceptions thrown from the outside
    doesn't catch exceptions lazily thrown in its pure result
  catchDeep
    catches exceptions thrown from the inside
    catches exceptions thrown from the outside
    catches exceptions lazily thrown in its pure result
  tryAny
    catches exceptions thrown from the inside
    doesn't catch exceptions thrown from the outside
    doesn't catch exceptions lazily thrown in its pure result

The next test is:

it "isn't fooled by BlockedIndefinitelyOnMVar" $ do

which suggests to me that something is going on with the "blocked indefinitely" behavior. Possibly a GHC regression?

@snoyberg
Copy link
Collaborator

I don't have much time to look at this right now, but a quick test on my machine did not reproduce this. I was using nightly-2018-03-14.

@DanBurton
Copy link
Contributor Author

@snoyberg that was a fortunate observation. I too am able to reproduce a passing test suite with nightly-2018-03-14. However, I am also able to reproduce the error with nightly-2018-03-17. This helps us isolate the cause, which is apparently hspec-2.5.0.

stack unpack enclosed-exceptions-1.0.2 && cd enclosed-exceptions-1.0.2
edit stack.yaml # try the various stack.yaml files
stack test
# stack.yaml
# requires stack upgrade --git
# test suite passes
resolver: nightly-2018-03-14
# stack.yaml
# requires stack upgrade --git
# test suite hangs
resolver: nightly-2018-03-14
extra-deps:
- hspec-2.5.0
- hspec-core-2.5.0
- hspec-discover-2.5.0
# stack.yaml
# test suite hangs
resolver: nightly-2018-03-17
# stack.yaml
# test suite passes
resolver: nightly-2018-03-17
extra-deps:
- hspec-2.4.8
- hspec-core-2.4.8
- hspec-discover-2.4.8

(For those who don't want to bother with stack upgrade --git, you can simply refer to the last 2 examples, which are sufficient to illustrate that hspec-2.5.0 is the cause of the discrepancy here.)

@DanBurton DanBurton changed the title Test suite hangs with ghc 8.4 Test suite hangs with ghc 8.4 (apparently due to hspec-2.5.0) Mar 17, 2018
@snoyberg
Copy link
Collaborator

This may be insurmountable, and the only result may be to disable the test. It appears that both the test case itself, and the hspec main thread, are blocked on MVars here, which is to be expected I suppose (depending on how hspec is implemented). GHC's runtime system doesn't know which thread to kill first, and so kills both of them. This is a common shortcoming with no obvious workaround. CC @jcristovao.

@DanBurton
Copy link
Contributor Author

How unfortunate. It seems like there should be some sort of workaround, and that workaround should be used by the tryAny function. Perhaps some sort of GHC primitive that says "I'm spawning a thread, but if both of us get blocked indefinitely, kill that one first." Would it make sense to make a GHC bug report or feature request for this issue?

In any case, I agree that with GHC as it is currently, there is probably nothing for enclosed-exceptions to do but disable the test case until something changes.

@snoyberg
Copy link
Collaborator

I don't think there's anything to be done at the GHC level. See this discussion on the async package: simonmar/async#14.

@ElvishJerricco
Copy link

Should this test simply be removed then, at least when building with 8.4? Nixpkgs always runs tests, so this obviously breaks with the 8.4 haskell package set. Not a big deal, since we can just disable the tests on this package, but it'd be nice if we didn't have to do that for future versions.

@peti
Copy link

peti commented Jul 10, 2018

We see this test failure in current Nixpkgs, too. We can produce the issue reliably, the test suite always fails (building in an LTS-12.0 environment).

@snoyberg
Copy link
Collaborator

@jcristovao do you have input on this, as this is your package? If you want, I'll make a call here, which would be: PR to remove the test would be acceptable.

@jcristovao
Copy link
Owner

Hey @snoyberg, feel free to make any changes that you deem necessary - I have been doing very little haskell nowadays, and I fully trust your judgement :)

@snoyberg
Copy link
Collaborator

Alright, have a look at #13. If/when CI passes, I'll merge and release to Hackage.

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

5 participants