Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubFlow's don't correctly propagate Supervision.resumeStrategy #1205

Closed
mdedetrich opened this issue Mar 18, 2024 · 10 comments · Fixed by #1207
Closed

SubFlow's don't correctly propagate Supervision.resumeStrategy #1205

mdedetrich opened this issue Mar 18, 2024 · 10 comments · Fixed by #1207
Assignees
Labels
bug Something isn't working release notes Need to release note
Milestone

Comments

@mdedetrich
Copy link
Contributor

mdedetrich commented Mar 18, 2024

In #252 I made it so that we can set SupervisionStrategy rather than using SubStreamCancelStrategy. It turns out there is an existing test which was written as pending (so its currently disabled) to test this exact SupervisionStrategy functionality (specifically SupervisionStrategy.resumingDecider when an exception is thrown) when its adding in the future (which is now) i.e.

https://github.com/apache/incubator-pekko/blob/c44c0b7cbdab11d85176cfe062288fdcba16c56a/stream-tests/src/test/scala/org/apache/pekko/stream/scaladsl/FlowSplitAfterSpec.scala#L213-L262

When I try to enable the test by removing pending so the test runs it actually does not pass which means that the SupervisionStrategy.resumingDecider is not properly catching and suppressing the exception as its meant to do so.

@mdedetrich mdedetrich added the bug Something isn't working label Mar 18, 2024
@mdedetrich mdedetrich added this to the 1.1.0-M1 milestone Mar 18, 2024
@mdedetrich
Copy link
Contributor Author

mdedetrich commented Mar 18, 2024

So I set the 1.1.0-M1 milestone for this bug, will do my best to solve it by the time the -M1 release is actually cut however if its not done by then can do it in a following -M2 or full release.

It does however need to be solved by full 1.1.0 release

@gwak
Copy link

gwak commented Jul 9, 2024

Hi @mdedetrich,

@pjfanning and I just tested the 1.1 milestone release with playframework. We followed the migration guide and explicitly defined the supervision strategy when using the splitWhen function like so:

.splitWhen(_.isLeft)
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider))
.prefixAndTail(1)

But when using the deprecated SubstreamCancelStrategy it works fine:

.splitWhen(SubstreamCancelStrategy.drain)(_.isLeft)

Is there something we're missing ?

@mdedetrich
Copy link
Contributor Author

@gwak So I still need to work on this, in the meantime I would recommend using the deprecated method as you described.

I just skimmed through the issue to recover some context, iirc the core issue is that in general ActorAttributes are not propagating where as in Pekko 1.0 and/or current pekko 1.1 deprecation functionality propagates the strategy in a different/more explicit way

@mdedetrich
Copy link
Contributor Author

Re-opening this as it needs to be solved

@mdedetrich mdedetrich reopened this Jul 9, 2024
@mdedetrich mdedetrich modified the milestones: 1.1.0-M1, 1.1.0-M2 Jul 9, 2024
@mdedetrich mdedetrich self-assigned this Jul 9, 2024
@mdedetrich
Copy link
Contributor Author

@gwak So I am diving into this now and I think that I fixed this issue in #1207 so things should be working as expected.

Reading your code example at surface level, maybe the problem is that you are not doing the equivalent of .lift which an be seen here

, you can see the definition of lift here

@gwak
Copy link

gwak commented Jul 9, 2024

@mdedetrich You were right, @pjfanning tried your suggestion in playframework/playframework#12794 and tests are passing. Thanks!

So the final flow is something like :

...
.splitWhen(_.isLeft)
.prefixAndTail(1)
.map { /*...snip...*/ }
.concatSubstreams
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider))

And not

...
.splitWhen(_.isLeft)
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider))
.prefixAndTail(1)
.map { /*...snip...*/ }
.concatSubstreams

@mdedetrich
Copy link
Contributor Author

Perfect! Closing ticket

@pjfanning
Copy link
Contributor

@mdedetrich would you have time to review the Pekko 1.1 migration docs? Would it make sense to suggest that the SupervisionStrategy should be be defined after the concatSubstreams call (if any)?

https://pekko.apache.org/docs/pekko/1.1/migration/migration-guide-1.0.x-1.1.x.html

.splitWhen(_.isLeft)
.prefixAndTail(1)
.map { /*...snip...*/ }
.concatSubstreams
.withAttributes(ActorAttributes.supervisionStrategy(Supervision.resumingDecider))

@mdedetrich
Copy link
Contributor Author

Sure, I'll do this today

@mdedetrich
Copy link
Contributor Author

PR created at #1391

@pjfanning pjfanning added the release notes Need to release note label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release notes Need to release note
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants