RxRedux
RxRedux copied to clipboard
Exception in side effect with multiple side effects will crash process
When having multiple side effects for a rxredux stream, if an exception occurs during the execution of the stream, the process will crash. The process wont crash if there is only one side effect for the given rxredux.
You can recreate the issue launching the Android app from https://github.com/vincentbrison/rxredux-sideeffect-issue
The full test case can be find in the ReduxTestError.kt file.
The excepted behavior should be the process does not crash if a side effect throw an error?
Thanks for reporting this issue and providing a sample that reproduces this issue.
Indeed, this seems to be a bug. It should not crash (unless you specify your own RxJava crash handler) but rather call the onError callback in both cases.
Hello, is this something you may address in the futur? Thanks!
We didn't have time to look into this in detail yet, but yes, we should fix that. In case you would like to look deeper in it, we would appreciate it. Otherwise, we are going to work on it at the first week of December.
Thanks for your quick response, that is good to know!
I did take a look, but I have limited knowledge in implementing custom Observable, so I am not sure to find something useful yet.
We are definitely looking into it but most likely we can't do it in November.
Thanks for giving this feedback :). This is not a blocking issue, since we could avoid it using error handling operators on side effects.
From what I see, the issue may come from https://github.com/freeletics/RxRedux/blob/733cf6341dd232d3e3de41ab7aaa0154638dba76/library/src/main/kotlin/com/freeletics/rxredux/ObservableReduxStore.kt#L161
All sides effects are subscribed to actionsSubject. More than one side effect will result in more than one actionsSubject.onError(error) for a given error (sort of a loop of error in the stream).
A solution (a hack?) could be to replace L161 actionsSubject.onError(error) by storeObserver.onError(error) to avoid to resend the error into actionsSubject stream and then avoid re trigger onError from other side effects.
Again, my understanding of custom observable is limited so it is just a guess ;).