-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Concat (hot) error handling guarantees #3090
Comments
The documentation seems to be a bit confusing. Concat only subscribes to one source at a time so if you have a second hot observable, |
That's good, because I was curios about "jump the queue" impl after playing with RxJava sources and debugging. So, let's fix documentation! Or other Rx implementations may have this "jump the queue" effect? |
I wrote this section of the docs, and I wish now I remember why. It may be It sounds like it's just confusing and misleading at this point, though, so On Mon, Jul 20, 2015 at 8:58 AM, Artem Zinnatullin <notifications@github.com
David M. Gross |
Okay, so let's just remove this marble diagram (main diagram is okay) and next paragraph?
I'd better add this info about hot observables and "Notice that if you pass hot Observable to the Concat Operator — you will miss all values emitted from hot Observable before completion of previously concatenated Observables because Concat only subscribes to one source at a time." It's really major piece of information. |
Note that is not a property of |
Sounds good. On Mon, Jul 20, 2015 at 10:55 AM, Artem Zinnatullin <
David M. Gross |
It is correct because the observables are cold. |
There's an ambiguity, I think, about how time is represented in marble If instead you interpret the left-to-right time as being relative to each I'd expect if I look over the diagrams I made for RxJava and for the On Mon, Jul 20, 2015 at 12:27 PM, André Staltz notifications@github.com
David M. Gross |
@staltz cold or hot does not matter in this case. @DavidMGross I guess marble diagrams will be more obvious for Rx users if time will be same for all Observables, let's fix it if it's possible? |
@DavidMGross' diagram look correct to me. If the second observable is cold, I guess there is no issue. But even if it is hot, there is no way to tell if any events happened before you subscribed, and hence it is correct as well. I am confused why @artem-zinnatullin is confused, and changing @DavidMGross' diagram will make people even more confused. |
Because X axis represents time, maybe I am wrong, but I think that time should be same for all Observables, this is how we (me and my coworkers) think about concurrent processes, probably it's the only good way to show this behavior:
Otherwise, if we will think that time is relative to each Observable there will be no way to show that something can be missed, no way to show that processes (Observables) are really concurrent on any marble diagram. |
Time is the same; for the second observable you do not see any marbles because the concat operator has not yet subscribed to it, so it would not make sense to show any. |
I am convinced this issue is a symptom of not understanding cold observables. An Observable is not an event emitter/bus, even though you can implement one with a hot observable. But even "hot observables" are just shared cold observables, hence it's vital to understand cold observables.
"Missing events" can only happen with hot observables. And cold Observables are not concurrent processes per se (their executions might be). That's the wrong abstraction. Observables are best understood as videos. You can watch (subscribe) them, but nothing really happens until you subscribe. If you think of them as videos, then the RxMarbles concat diagram makes a lot of sense. And if that diagram is assuming cold behavior, then I'd rather even keep the diagram there to help people see the cold behavior. Watch this for more. |
IMHO (me and my team actually invented marble diagrams) the RxMarbles diagram for concat is not correct. Showing a marble at a certain point on the timeline means the operator is subscribed to that stream. Do don't know anything about a stream until you subscribe. |
Alright I get that argument. Was hard to talk about axis x for "same time". I'll fix concat diagram then. |
Yay! |
I guess, this issue can be closed, documentation is fixed, I hope RxMarbles will be fixed too, but on RxJava side everything now looks consistent. Thanks everybody! |
According to the documentation of the Concat operator http://reactivex.io/documentation/operators/concat.html error, happened on one of the source observables may (keyword here) "jump the queue" and trigger
onError
of theConcat
Observable.But this simple test fails (same as marble diagram):
Is it expected behavior or there are no guarantees that error will "jump the queue" and trigger
onError
on theConcat
Observable? We just faced it in production (not critical problem, but we expected behavior according to the documentation).P.S. Checked on RxJava 1.0.12 and 1.0.13-SNAPSHOT (today), also tried to emit values from different threads — no difference. I can submit this test as PR if you want.
The text was updated successfully, but these errors were encountered: