Sitelet https://github.com/purescript-contrib/purescript-aff/issues/140
Skip to content

Supervised forks do not rethrow exceptions when joined #140

Description

@felixSchl
main :: Eff _ Unit
main = void $ launchAff do
 fiber <- forkAff $ do
   mainT <- forkAff $ supervise do

     traceAnyA "tick 1"
     delay $ 1000.0 # Milliseconds

     traceAnyA "tick 2"
     delay $ 1000.0 # Milliseconds

     void $ liftEff (throwException (error "die"))

     traceAnyA "tick 3"
     delay $ 1000.0 # Milliseconds

     traceAnyA "tick 4"
     delay $ 1000.0 # Milliseconds

   void $ joinFiber mainT
   traceAnyA "done"
 void $ joinFiber fiber
 traceAnyA "done 1"

This program produces the following output:

> pulp run
tick 1
tick 2
>

The thrown exception does not get rethrown when trying to joinFiber mainT or joinFiber fiber and the program just peacefully terminates. Expected it to rethrow the exception as soon as I joinFiber the offending fiber.

This behaviour does not occur when mainT is not supervised.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions