-
Notifications
You must be signed in to change notification settings - Fork 3k
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
takeUntil exhibits weird behavior when notifier is a previously completed connectable observable #3853
Comments
Before getting into details, is this happens same with asynchronous sources other than synchronous ones? operators like takeuntil usually do not play well with synchronous soruces (cause it's being observed synchronously, literally) so curious about those. |
@kwonoj I tried with EDIT: In all cases, there's a publish at the end of the notifier pipe followed by a connect, so what is being passed to takeUntil is always a connectable, at least from how I'm seeing things. And all of my tests behave correctly if I remove the connect, or if I make sure that the notifier doesn't emit until after the 1000ms timeouts have run. |
I'm experiencing the same issue in one of our bigger applications where this pattern is kind of common.
I would expect that the source observable completes directly in this case |
FYI, I started looking into this a short while ago. The reported behaviour seems to be related to two issues one of which is what @bene-starzengruber has pointed out: if the notifier has completed, the source is not even subscribed to. I'll add a comment with everything that I've found once I've spent some more time with it and have completely figured out what's going on. |
so does that mean, that there is no risk of creating a memory leak this way? |
@bene-starzengruber From what I've seen, I doubt there'll be a problem with it leaking, as it doesn't subscribe. I'll be able to say more once I fully understand what's going on. TBH, the part that I cannot explain yet is the difference in behaviour between a notifier that's scalar and one that's not. I'll get to the bottom of it. Eventually. |
@cartant as some time passed since the issue was created and you were looking into it I thought I could ask for feedback on how to proceed with this. |
This is no longer an issue in 6.5 and higher. |
Bug Report
Current Behavior
Some connectable observables when used as
takeUntil
notifiers seem to causetakeUntil
's source observable to enter a sort of hung state where nothing will be emitted and in most cases no completion will happen either. Appears to only happen when the source observable is created after the notifier has completed.Reproduction
Expected behavior
The beta docs indicate that if
takeUntil
's notifier never emits and then completes,takeUntil
is supposed to allow all values. SupplyingtakeUntil
withNEVER
confirms this reading. Based on that understanding:test1
example above,takeUntil
should have allowed an emission, but at least allowed the expected completion.test2
andtest3
examples above,takeUntil
should have allowed emissions, and somehow didn't even allow completions.takeUntil
definitely completed before the test observables were created.My assumption is that all three test cases should have behaved identical to the control case, in which a single value was emitted, followed by a completion.
This would not be the first time I've been bitten by some misunderstood nuance of hot observables, but as far as I can tell the hot observable is behaving exactly as I expect it to, but
takeUntil
is not.Environment
The text was updated successfully, but these errors were encountered: