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

TCK: Coupled operator vs rule 2.3 #131

Open
danielkec opened this issue Dec 16, 2019 · 7 comments
Open

TCK: Coupled operator vs rule 2.3 #131

danielkec opened this issue Dec 16, 2019 · 7 comments
Milestone

Comments

@danielkec
Copy link
Contributor

Coupled operator needs to signal cancel to parallel stream's upstream on its completion, but rule 2.3 forbids direct call from onComplete to cancel. Since the streams are actually parallel is the rule 2.3 and its tck test actually applicable? Same goes from onError->cancel call.

There was already discussion on https://gitter.im/eclipse/microprofile-reactive#

@Azquelt
Copy link
Member

Azquelt commented Dec 16, 2019

I don't think this violates 2.3 because you're not calling cancel() on the subscription from the publisher which sent the onComplete().

I'm not sure what you mean by "parallel" stream. As I read it, the couple operator is a processor (and therefore has an upstream and a downstream), when you create it, you pass in a Subscriber sub and a Publisher pub. The couple then passes elements from upstream to sub and elements from pub to downstream.

In the scenario you're talking about, upstream has called onComplete and the couple has to

  • call onComplete on sub
  • call cancel on the subscription from pub
  • call onComplete on downstream

I think rule 2.3 would only apply if you were to try to call cancel on the subscription received from upstream, which the spec does not require you to do.

@danielkec
Copy link
Contributor Author

Yes but TCK test for rule 2.3 doesn't care about originating stream, it just looks for method called "onComplete" in call stack. Rule 2.3 should not be applied to coupled processor because its publisher and subscriber are not subscribed to each other right?

@cescoffier
Copy link
Contributor

@danielkec Agreed. We need to fix that in the TCK, or if possible improve the detection.

@danielkec
Copy link
Contributor Author

danielkec added a commit to danielkec/helidon that referenced this issue Feb 2, 2020
@olotenko
Copy link

olotenko commented Feb 12, 2020

I wonder how they are going to enforce rule 2.3 at all. Subscriptions are meant to be used concurrently. Plenty of rules specifically allowing request and cancel to be called synchronously, and references to possibility of request or cancel and onNext to be on different threads. All this implies it may well be during onComplete.

Rule 1.6 is the rule that makes sense. Once onError or onComplete is entered, the Subscription is as good as cancelled. There are several rules that require the Subscription to behave as no-op after it is cancelled.

In other words, 2.3 is moot.

@akarnokd
Copy link

The TCK checked for any method named onError or onComplete in the stacktrace when a call was made to request or cancel, even though those originated from another thread or before the test itself called onComplete or onError.

Fix posted to the TCK: reactive-streams/reactive-streams-jvm#483

@Emily-Jiang
Copy link
Member

Waiting for Reactive Streams TCK release and then consume it.

@Emily-Jiang Emily-Jiang added this to the Future milestone Jul 15, 2020
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

No branches or pull requests

6 participants