Skip to content

Resolve undefined IO throwing behavior in the presence of async and non-termination #110

Open
@jnape

Description

@jnape

Suppose we have the following IO tree:

IO<Object> throwImmediately = IO.throwing(new IllegalStateException("head fell off"));
IO<Unit> parkForever = io((SideEffect) LockSupport::park);
throwImmediately.discardL(parkForever).unsafePerformAsyncIO().join();

What should the result be? Should it throw, or block?

Intuitively, it feels like it should probably throw immediately, and why wouldn't it? Well, because there is asynchrony, and since discardL is just a sugary zip call, and since zip can only execute once both results have been computed, the backing future holding the thrown exception will never be interrogated, so the exception will never propagate.

Investigate whether or not a principled approach to parallel IO can also easily immediately propagate exceptions under the context of asynchrony without violating correctness.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions