-
Notifications
You must be signed in to change notification settings - Fork 533
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
Second Subscription rule #480
Comments
First of all, Rule 1.3 requires serial signaling thus if a The test is there to verify if the proper cancellation is happening for at least the non-racing scenario and helps detecting certain type of reuse bugs. Sometimes, you can safely reuse the same |
I read I agree it may be useful to signal |
I read your comments on that flatMap commit and not sure what the problem is. Is it that the inner subscriber is failing the TCK because of it implements a relaxed ruleset? Just don't test it with the TCK then. Is it trust issues regarding All in all the TCK lets you verify conformant behavior in a limited way and I don't think it should be removed just because someone's use case doesn't fit it. |
The inner subscriber can be written without that check. The runtime overhead is low, but the reasoning is harder when there are more things to think about. The issue is that that rule does not improve |
Then ignore it if you still see value in the other verification methods. |
Oh, I see why the concern. Some of your project's own code wouldn't pass the TCK. |
There are several things that are done incorrectly in that project. But getting it to a better level requires a sensible set of rules. |
The rules have been fine, although not optimal, since the release of the spec/api/TCK. Some properties of the spec/TCK can be worked around just as fine. So what action do you think (On a side-note, I'd really like to know, were these free and voluntary contributions or were they written by people paid to be working on the project?) |
Regarding the legal status of the contributions to that other project - you better contact the owners of the project. I think it would be satisfactory to downgrade the MUST to SHOULD or something. On our side we can pick the tests that we like, or implement the strict check, it is not that expensive, just quirky and not much help. |
Given that it is illegal by spec to attach the same Subscriber instance twice, that is already a spec violation in itself. |
It is ok to require that no one expects arbitrary |
@olotenko Publishers are reusable by spec. Regarding Subscribers, if you know that a Subscriber is reusable, and you can clearly tell when it is safe to be reused, then you are of course free to do so. This is the same situation as with Iterators, only when knowing strictly more than simple Iterator is it safe to call |
Sure. But you see the point, right? That the spec says "for all", whereas it should say "exists". |
I can see what you mean when expanding the scope to all uses of these interfaces. The intended scope, as documented in the preamble, is to define behavior for the interaction of Publishers and Subscribers across boundaries, both async and organizational; the main goal is interoperability. This goal is only achieved by saying “all conforming implementations do X”, otherwise one implementor cannot rely on the behavior to be displayed by another implementation when plugged together by a third party. |
The flaw in reasoning is that "all conforming implementations do X" does not mean every "do" applies to every "X". Eg if you reword the requirement as "all conforming Instead, the spec is defining a required handling of non-conforming |
@olotenko The reason for the symmetric check is to have a better chance of detecting violations on both sides of the fence (Publisher or Subscriber). If we were to rely on everything always doing the right thing, no TCK would ever be needed, because everyone would do what is expected of them, at all time. My experience in the software industry tells me that bugs and misinterpretation is commonplace, and therefor the TCK tries to do its best to avoid both of them. At least that's the rationale behind my reasoning. |
@viktorklang :) |
@olotenko From the perspective of the Subscriber, it is already cancelled. So I'm not sure how that matters? A generic Subscriber should never receive two onSubscribe calls. |
@viktorklang :) in the context of cancelling the second Say, normally a Abnormally the There is no defence against misbehaving Add to that the conforming |
Back to the original question. @olotenko points out that the tck test is too strict. The spec implies "eventually", but the check is immediate. This is a classic testing issue; the usual compromise is to wait (sleep) long enough that "eventually" is sure to have happened in the testing context. Here, maybe a few seconds. |
I imply more than that. Not calling |
@DougLea Adding some sort of polling cycle until a timeout is definitely possible. |
https://github.com/reactive-streams/reactive-streams-jvm/blob/master/tck/src/main/java/org/reactivestreams/tck/SubscriberWhiteboxVerification.java#L216-L219
This rule and this test make no sense.
Publisher
is allowed to observe cancellation "eventually".Publisher
is allowed to callonError
oronComplete
without receivingrequest
.on*
methods do not distinguish whichSubscripiton
it is for. So if theSubscriber
receives twoonSubscribe
, it may still receive variouson*
that will break the specification. (OnePublisher
doesonComplete
anotherPublisher
doesonNext
)In other words, there is no defence against non-conformant
Publisher
, or the systems that permit such a racy subscription to happen.The text was updated successfully, but these errors were encountered: