Closed tzm41 closed 7 years ago
Hi @tzm41 ,
I believe this is a bug with RxRealm. This line should be deleted.
https://github.com/RxSwiftCommunity/RxRealm/blob/master/Pod/Classes/RxRealm.swift#L142
And all other observer.onCompleted
calls in dispose methods, like
https://github.com/RxSwiftCommunity/RxRealm/blob/master/Pod/Classes/RxRealm.swift#L204
Could you please make a PR to RxRealm?
Ahhhhh very nice catch! I will make a PR for them. Thanks so much!
By the way, do you know why causes the recursion? In our own code, we do not call complete on the observer for the dispose action.
The lines I've just told you about probably cause it, unless there is also some other bug.
Right, but why would calling on complete of the observer cause recursion?
First element ->onNext
-> take 1 causes disposal as a result -> onCompleted
is attempted.
Thanks for explaining.
Short description of the issue: I create an observable from Realm objects to retrieve one single object from the storage. Whenever I use
.take(1)
when I subscribe to it I get crash from RxSwift.Expected outcome: Should go crash free.
What actually happens: Fatal error with warning
Warning: Recursive call or synchronization error!
, if I use.take(1)
. Of course it does not crash when I take the.take(1)
out, but that would be a logical error in the code and result in undesired behaviors. Not totally sure it is Realm or RxSwift's issue?Self contained code example that reproduces the issue:
Stack trace
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
RxSwift 3.4.0
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)
Level of RxSwift knowledge: (this is so we can understand your level of knowledge and formulate the response in an appropriate manner)