You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shake cmd does not deal with async exceptions #538
The following program terminates when the action for a produces a failure, without waiting for action b to finish. Shouldn't shake wait until b completes?
$ cat test.hs
import Control.Concurrent
import Development.Shake
import System.Environment
main = withArgs ["-j"] $ shakeArgs shakeOptions $ do
want ["a", "b"]
"a" %> \_out -> do
liftIO $ threadDelay (100 * 1000)
fail "ugh"
"b" %> \_out ->
cmd Shell "sleep 3 && echo hello"
$ ghc-8.0.2 --make -threaded test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
$ ./test
# sleep (for b)
Error when running Shake build system:
* a
ugh
$ hello
When one action fails, Shake attempts to kill all the other actions that are underway, to return an error message to the user as fast as possible. From your trace, that seems to be what is happening - can you confirm?
That's not what's happening. Shake seems to return immediately, and the action for b completes afterwards. Note that the hello message is printed after the new bash prompt is printed.
If the action for b were killed, the hello message would never print.
changed the title [-]Shake does not wait for concurrent actions before finishing[/-][+]Shake cmd does not deal with async exceptions[/+]on Oct 14, 2017
Actually, it's caused by Shake not dealing with async exceptions properly in cmd - Shake does clean up (using async exceptions) and cmd incorrectly ignores them. I've found a nice test case and added it to the test suite, now to fix it's behaviour...
Looking at the code, there's way too much try_, ignore, forkIO etc in the code. I don't know which one is causing the problem, but I'm tempted to remove most/all of them, and then see if the bug goes away - and in the process will probably also squash a lot of other bugs.
Activity
ndmitchell commentedon Oct 2, 2017
When one action fails, Shake attempts to kill all the other actions that are underway, to return an error message to the user as fast as possible. From your trace, that seems to be what is happening - can you confirm?
facundominguez commentedon Oct 3, 2017
That's not what's happening. Shake seems to return immediately, and the action for
bcompletes afterwards. Note that thehellomessage is printed after the new bash prompt is printed.If the action for
bwere killed, thehellomessage would never print.#538, add a test case
[-]Shake does not wait for concurrent actions before finishing[/-][+]Shake cmd does not deal with async exceptions[/+]ndmitchell commentedon Oct 14, 2017
Actually, it's caused by Shake not dealing with async exceptions properly in
cmd- Shake does clean up (using async exceptions) andcmdincorrectly ignores them. I've found a nice test case and added it to the test suite, now to fix it's behaviour...ndmitchell commentedon Oct 14, 2017
Looking at the code, there's way too much
try_,ignore,forkIOetc in the code. I don't know which one is causing the problem, but I'm tempted to remove most/all of them, and then see if the bug goes away - and in the process will probably also squash a lot of other bugs.#538, remove a try that was incorrectly catching timeout errors
#538, simplify the error checking because we no longer catch arbitrar…
#538, make sure processes can be killed properly
ndmitchell commentedon Nov 6, 2017
I've fixed a bunch of stuff in Shake, but come down to underlying bugs in Process now: haskell/process#107