Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

@adamgfraser adamgfraser commented Sep 28, 2020

The current implementation calls forever on the worker fibers. If foreachParN is called in an uninterruptible region this can result in creating fibers that continue forever and are not interruptible, potentially causing nontermination in higher levels of the application if the application waits for the interruption of these fibers through auto supervision. This is particularly problematic because foreachParN is called in an uninterruptible region in the release action of ZManaged when the execution strategy is ParallelN, which is the default in ZIO Test.

@adamgfraser
Copy link
Contributor Author

Seeing a dramatic improvement to stability of CI with this change.

@ghostdogpr
Copy link
Member

Wow 🤩 👏

ghostdogpr
ghostdogpr previously approved these changes Sep 28, 2020

def worker(q: Queue[(Promise[E, B], A)], pairs: Iterable[(Promise[E, B], A)], ref: Ref[Int]): URIO[R, Unit] =
ref.getAndUpdate(_ - 1).flatMap { remaining =>
if (remaining >= 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: you could use ZIO.when

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Updated now.

@adamgfraser adamgfraser merged commit a70f4a0 into zio:master Sep 28, 2020
@adamgfraser adamgfraser deleted the foreachParN branch September 28, 2020 16:56
@sideeffffect
Copy link
Member

These are splendid news 🎆
Thank you @adamgfraser 👏 , would it be possible to release ZIO with this improvements, so that ZIO Prelude tests/CI can also benefit?

@adamgfraser
Copy link
Contributor Author

@sideeffffect Yes I think we should definitely do another release very shortly. Ideally would like to get some version of the TestClock changes in as well, so I think in the next day or two.

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

Successfully merging this pull request may close these issues.

3 participants