-
Notifications
You must be signed in to change notification settings - Fork 534
fix contradicting provisions around subscribing multiple times #63
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
Comments
|
|
|
Is the subscribe operation required to be thread safe ? I'd like to be adaptive and provide a composite subscription only for multicast (more than 1 successful subscribe call). Problem occurs when switching Publisher reference to subscription (to broadcast hot events), for a composite subscription. This operation needs a memory barrier to access the subscription field and update it. I'd just like to avoid that by assuming external synchronization if subscribe is called by different threads/resources. |
@smaldini Could you elaborate on the problem? I assume you control the Publisher implementation? |
@smaldini ping |
Thinking more about this I assume that subscribe needs to be thread safe, or rather, safe for concurrent subscribers. |
This could hurt performances tho, I mean the implementor can make sure of this but enforcing it is a serious constraint to consider. But if we optimise for unicasting, dynamically switching to multi casting (with a multi subscriptions Subscription). Sent from my iPhone
|
How many subscribers per second are you anticipating?
|
The issue is more about the stream data rate. It can only be 1 subscriber with 10M onNext / s. Introducing the subscriber in this stream will block/add overhead, but there might be solutions to that I need investigate anyway. I would be reluctant technically speaking but the rule would make sense in general. Sent from my iPhone
|
How (what Thread) would new Subscribers normally enter the picture (given
|
This seems like it should be up to each implementation to worry about, doesn't it? A unicast/cold source starts fresh each time, whereas a multicast/hot source is sharing state. The latter would handle concurrency as needed whereas the former wouldn't need to as it shares no state. |
I don't even understand this rule. Why would a
Rule 1.11 also gets involved in this.
I suggest this line needs to be removed and just be covered by the replacement I suggest above about a
Line 2.12 prevents a Subscriber from being reused. Is that the intent? Or are we instead trying to say that for any given Either way, this is where the contradiction with 3.13 happens:
Note this portion "Re-subscribing with the same Subscriber object is discouraged [see 2.12]," where we say it is discouraged, yet in 2.12 we say MUST NOT so actually prevent re-use as currently worded. Possibly 2.12 could be replaced with:
Thus, I'd do the following:
|
On Fri, Jul 18, 2014 at 6:27 PM, Ben Christensen [email protected]
Subscribers "never" subscribe though, it's almost always outside code that
But that may be a good thing to disallow, I'm just raising it here so that
Cheers, |
Re-subscribing a Subscriber to a different Publisher after the current Publisher calls onComplete is useful. For instance, when concatenating Publishers, especially where the list of all Publishers is not known in advance. I occasionally have to feed data from multiple sources into the same (stateful) processor, one after the other. If you forbid this, then in such situations one will have to create a Subscriber for each Publisher that simply passes data to a the same (stateful) object, let's call it a collector, whose only significance is that it looks just like a Subscriber but doesn't actually implement the Subscriber interface, so it's allowed to be resubscribed. That's not a big burden technologically (at least if subscribe events are infrequent and there is no performance problem), it just looks ugly IMO. On the other hand, an |
On Jul 18, 2014 11:43 PM, "√iktor Ҡlang" [email protected] wrote:
So this mean that even if a Subscriber doesn't have an active
Subscribers "never" subscribe though, it's almost always outside code
Good question, should it?
This would mean that you couldn't cache Subscriber instances and reuse
But that may be a good thing to disallow, I'm just raising it here so
Doesn't that imply that a Publisher must remember all active subscribers?
Before we do anything, perhaps we should propose semantics for Ack, typo: I meant semantics of Publisher.subscribe and
|
@reactive-streams/contributors Ping. |
@reactive-streams/contributors Pong. |
@reactive-streams/contributors Ping. |
@reactive-streams/contributors Vote to close due to inactivity and failure to observe proper Ping/Pong protocol. 👍 or 👎? |
The contradictions still exist. Should I submit a pull request with my suggestions (#63 (comment))? |
Submit PR so we can discuss and settle it before 1.0.0-RC1 :-)
|
@benjchristensen ping |
I'm crushed right now so it's not going to happen for me until after ReactConf. This stuff is good enough for 1.0-RC1. I propose leaving this open for me to attempt clarifying things later. |
@benjchristensen No worries. Let's revisit when possible. Your work on the 1.0 release track is inspiring to say the least! |
Moving this discussion to #178 :-) (reopen if you feel this was not appropriate) |
We need to find wording which mandates sane behavior while not requiring all Publishers to keep track of all the past Subscribers indefinitely.
The text was updated successfully, but these errors were encountered: