Android 7上的Retrofit 2 + RxJava StackOverflowError

时间:2017-08-22 07:03:42

标签: android rx-java retrofit2 android-7.0-nougat android-7.1-nougat

我看到Crashlytics中仅有一些与Retrofit 2和RxJava相关的Android 7中的错误。根本没有提及任何应用程序代码。设备尚未植根,应用程序主要不在焦点。到目前为止,我的任何设备都没有被复制。

Stacktrace如下:

Fatal Exception: java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
   at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:114)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:154)
   at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by java.lang.StackOverflowError: stack size 1037KB
   at rx.exceptions.Exceptions.throwIfAny(Exceptions.java:174)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:144)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.subscriptions.CompositeSubscription.unsubscribeFromAll(CompositeSubscription.java:186)
   at rx.subscriptions.CompositeSubscription.unsubscribe(CompositeSubscription.java:175)
   at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:136)
   at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:125)
   at rx.Subscriber.unsubscribe(Subscriber.java:98)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:820)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.onError(OperatorMerge.java:276)
   at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.onError(OperatorMerge.java:276)
   at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
   at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:852)
   at retrofit2.adapter.rxjava.OperatorMapResponseToBodyOrError$1.onError(OperatorMapResponseToBodyOrError.java:52)
   at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:178)
   at rx.Subscriber.setProducer(Subscriber.java:211)
   at rx.Subscriber.setProducer(Subscriber.java:205)
   at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
   at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
   at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
   at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
   at rx.Observable.unsafeSubscribe(Observable.java:10256)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
   at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
   at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
   at rx.internal.util.ScalarSynchronousObservable$ScalarAsyncProducer.call(ScalarSynchronousObservable.java:200)
   at rx.internal.util.ScalarSynchronousObservable$2$1.call(ScalarSynchronousObservable.java:114)
   at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:154)
   at android.os.HandlerThread.run(HandlerThread.java:61)

问题不是供应商特定的(三星,摩托罗拉,华为等)。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

基于堆栈跟踪,您似乎拥有非常嵌套的merge运算符。是否有任何地方可以使用Observable集合并执行类似

的操作
Iterator<Observable<T>> it = collection.iterator();
Observable<?> obs = it.next();
while(it.hasNext()) obs=obs.merge(it.next()); 

或等效的东西(可能通过.scan())?