You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, the code takes several strings and tries to parse them as integers. In this case all numbers are processed successfully, so the success dialog is shown. If I use the following sequence:
Then the error dialog appears, because one of the items cannot be parsed as number. This is a correct behavior. However, if I add two incorrect items instead of one:
Then the application just crashes. It seems to me that the reason is because the exception happened in two threads at once, but I may be wrong in the conclusion.
When I implement the parallelization the old way, the application doesn't crash:
Thanks for reporting. There is a fix waiting for review/feedback about the same issue: #5117 (reported in #5108).
As for the doParallelAsyncJobOldWay, it doesn't crash the app but also doesn't process "3" .. "8" because Integer.parseInt crashes the function of the flatMap before it could create an async source for the rest of the input numbers.
@akarnokd Thanks for the clarification! I added the global error handling and the application doesn't crash. However, I see the behavior different from what you've described. I download a lot of small bitmaps in parallel, and if loading of some bitmap fails with an IOException, the rest of the bitmaps is loaded anyway, even after onError block is finished. Do you happen to kn how I can workaround this so they won't be loaded?
Depending on which rail fails and when, many of the other's may successfully emit their results before the whole setup gets cancelled. However, if one of the rails fails before the others can make progress, it should stop them and fail the stream with an error:
Great! Sounds like you could resolve your particular case, therefore, I'm closing this issue for now. The underlying issue, namely the handling of failure within parallel flows can be discussed in #5128.
In Android application I'm trying to perform a simple parallel task using
ParallelFlowable
from RxJava 2.0.6.As you can see, the code takes several strings and tries to parse them as integers. In this case all numbers are processed successfully, so the success dialog is shown. If I use the following sequence:
Then the error dialog appears, because one of the items cannot be parsed as number. This is a correct behavior. However, if I add two incorrect items instead of one:
Then the application just crashes. It seems to me that the reason is because the exception happened in two threads at once, but I may be wrong in the conclusion.
When I implement the parallelization the old way, the application doesn't crash:
The text was updated successfully, but these errors were encountered: