Go to file
Falco Peijnenburg 798d9e8967 Fixes MVar blocking exception
Uses the fix mentioned by @arianvp in
https://github.com/haskell-servant/servant/pull/425.

See also
https://github.com/haskell-servant/servant/issues/51#issuecomment-250737727

The cause of the issue very is similar to the issue described
in this blog post:
https://www.fpcomplete.com/blog/2016/06/async-exceptions-stm-deadlocks

The main thread creates a waiter, creates an asynchronous callback which is
called when the `readyState` of the request changes. When the readyState
changes to 4, which means 'request finished', the waiter MVar is put.
The main thread takes the MVar and continues to do stuff with the response.

The problem is that the `readyState` can change to 4 more than once,
for some reason. The second time this happens, the waiter MVar can be put
again, since the main thread took it. The main thread, however, won't take
it again. After all, it only needed to take the MVar once to know that the
request was finished. The third time `readyState` is set to 4, the putMVar
would block, causing the following exception to be thrown:

```
thread blocked indefinitely in an MVar operation
```

Since state 4 should really mean that the response is ready, it seems
appropriate to decide that all changes of the state to 4 after the initial one
can be safely ignored.
2016-09-30 18:12:22 +02:00
doc bump version 2016-09-17 11:47:57 -04:00
scripts switch ci to stack and add ci cron job to test hackage breakage 2016-08-17 14:12:12 +02:00
servant bump version 2016-09-17 11:47:57 -04:00
servant-client Fixes MVar blocking exception 2016-09-30 18:12:22 +02:00
servant-docs bump version 2016-09-17 11:47:57 -04:00
servant-foreign bump version 2016-09-17 11:47:57 -04:00
servant-js bump version 2016-09-17 11:47:57 -04:00
servant-server bump version 2016-09-17 11:47:57 -04:00
.gitignore servant-client: support for ghcjs 2016-05-13 15:41:07 +08:00
.stylish-haskell.yaml Contributing 2015-08-17 23:50:42 +02:00
.travis.yml switch ci to stack and add ci cron job to test hackage breakage 2016-08-17 14:12:12 +02:00
CONTRIBUTING.md add 'stack setup' command 2016-09-02 12:43:22 +02:00
GHCJS.md added GHCJS.md 2016-05-13 16:11:13 +08:00
HLint.hs Contributing 2015-08-17 23:50:42 +02:00
README.md set the homepage to readthedocs 2016-04-22 14:12:21 +08:00
servant.png Update READMEs 2015-04-20 15:48:37 +02:00
sources.txt Move servant-mock to https://github.com/haskell-servant/servant-mock 2016-09-08 17:42:58 +03:00
stack-ghc-7.8.4.yaml Bounds and stack files 2016-09-12 18:34:18 -03:00
stack-ghc-8.0.1.yaml Bounds and stack files 2016-09-12 18:34:18 -03:00
stack.yaml Support http-api-data-0.3 2016-09-12 18:34:00 -03:00

servant - A Type-Level Web DSL

servant

Getting Started

We have a tutorial that introduces the core features of servant. After this article, you should be able to write your first servant webservices, learning the rest from the haddocks' examples.

The central documentation can be found here. Other blog posts, videos and slides can be found on the website.

If you need help, drop by the IRC channel (#servant on freenode) or mailing list.

Contributing

See CONTRIBUTING.md