-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
PublishSubject onCompleted from different disposeBag #1439
Comments
Hi @grinder81 , can you please provide me with some code that reproduces this issue? It is not clear what is |
|
Can you repro that in a standalone example project? If so, do you mind sending me that project? |
I tried to create a simple project to reproduce it but that doesn't happen :( I wish I could do that. Is there any particular area I can focus to trace it down? I have other publish subject but it doesn't happen with other cases. I tried to force it to subscribe on the main scheduler to see is that event anomaly or not but didn't help. |
I would assume that there is a faulty rx extension somewhere. Usually what happens is that somebody is using Because Swift has struct reusing, those two facts combined usually results in that kind of behavior. I would also suggest tracing the creation of all of the subjects, printing their addresses and similar. Sorry, can't help you more without repro. Good luck! |
I think you gave me the biggest hint. I have following pod https://github.com/RxSwiftCommunity/NSObject-Rx which is using https://github.com/RxSwiftCommunity/NSObject-Rx/blob/master/HasDisposeBag.swift I'm going to dig. I really appreciate your feedback and I can't expect more than that as I can't give a sample project to you. Thanks a lot and will let you know how it ends up. If you see anything in that pod which is bad, please let it know here. |
Just to give an update. I did quite an investigation.
But still, I'm seeing that issue. Which means I can't blame this pod for memory leaking. I'll keep digging. |
Short description of the issue:
Wrong disposeBag triggering
onComplete
for another publish subject.Explanation:
So far this is the weirdest problem I'm dealing with my project using RxSwift. Here are the details:
Publish Subject holder class:
Class subscribing publish subject:
From my other class, I'm just doing something like
That's it!
Problem:
Everything works fine as expected. I publish an enum and
MyPublishSubscriber
do some work based on that enum. But in a very certain case which is reproducible every time,onCompleted
get called though I never did haveonComplete
call for this publish subject. Then when I started digging memory footprint I found autorelease pool clearing memory which callsdeinit
of adisposeBag
and that's lead toonCompleted
and thenonDispose
.Please note that I tracked memory location of
MyPublishSubscriber
rx.disposeBag
and then the one is getting free and this one completely different memory location or address.Right now I don't see a way to dig more.
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
3.x
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
7,8 and 9
The text was updated successfully, but these errors were encountered: