ReactiveX / RxJava

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Apache License 2.0
47.92k stars 7.6k forks source link

Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError #5508

Closed longzc1314 closed 7 years ago

longzc1314 commented 7 years ago

This is when I am in the use of Retrofit + Rxjava TalkingData statistics to the problem above.Appear in high frequency.But not return, don't know how to solve,

This is the version I used: compile 'com.squareup.retrofit2:converter-gson:2.0.2' compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' compile 'com.squareup.retrofit2:retrofit:2.0.2' compile 'io.reactivex:rxandroid:1.1.0' compile 'io.reactivex:rxjava:1.1.0'

This is the error log:

java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
    rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java)
    android.os.Handler.handleCallback(Handler.java:743)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:150)
    android.app.ActivityThread.main(ActivityThread.java:5621)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
    rx.observers.SafeSubscriber._onError(SafeSubscriber.java)
    rx.observers.SafeSubscriber.onError(SafeSubscriber.java)
    rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java)
    rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java)
Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
Caused by : rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
akarnokd commented 7 years ago

The log is trimmed and it seems your error handler in subscribe() is failing. Please provide the full stacktrace and the code exhibiting the failure.

longzc1314 commented 7 years ago

The complete error log shown above is above and I can't reproduce myself, most of which is huawei's phone,Excuse me, can I avoid the above problem,

@Override public void onError(Throwable e) { try { if (e instanceof OnErrorFailedException) { // e.printStackTrace(); } else { onFailure(e.getMessage(), ""); } } catch (Exception e1) { e1.printStackTrace(); } }

longzc1314 commented 7 years ago

@akarnokd The complete error log shown above is above and I can't reproduce myself, most of which is huawei's phone,Excuse me, can I avoid the above problem,

@override public void onError(Throwable e) { try { if (e instanceof OnErrorFailedException) { // e.printStackTrace(); } else { onFailure(e.getMessage(), ""); } } catch (Exception e1) { e1.printStackTrace(); } }

akarnokd commented 7 years ago

There is not enough information in the log and the code snipplet, to me, has only the onFailure(e.getMessage(), ""); call that may fail for some reason. Without further information, I'm afraid we can't help you much.

longzc1314 commented 7 years ago

@akarnokd Does this problem cause the app to drop out, I can't reproduce it myself, and there's so much information on TalkingData, so what's going to make this error

akarnokd commented 7 years ago

If I have to guess, there is probably a network connection error somewhere which is not handled properly and the default subscriber just crashes for errors. If you could show what's in onFailure(e.getMessage(), ""); or generally in your onError handlers, that might move us forward.

akarnokd commented 7 years ago

Looks like this question has been answered. If you have further input on the issue, don't hesitate to reopen this issue or post a new one.

weigg520 commented 6 years ago

09-17 19:56:41.304 24357-24357/com.cnbot.kgrobot E/AndroidRuntime: FATAL EXCEPTION: main Process: com.cnbot.kgrobot, PID: 24357 java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread. at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5280) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758) Caused by: rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:192) at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120) at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264) at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207) at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5280)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)  Caused by: rx.exceptions.CompositeException: 2 exceptions occurred. at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:192)  at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)  at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264)  at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207)  at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)  at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5280)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)  Caused by: rx.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received => at com.aimall.easylib.utils.CrashHandler.getStackTraceString(CrashHandler.java:61) at com.aimall.easylib.utils.CrashHandler.saveCrashInfo2File(CrashHandler.java:202) at com.aimall.easylib.utils.CrashHandler.handleException(CrashHandler.java:118) at com.aimall.easylib.utils.CrashHandler.uncaughtException(CrashHandler.java:86) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:66) at android.os.Handler.handleCallback(Handler.java:739)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5280)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)  Caused by: java.net.ConnectException: Failed to connect to /192.168.40.254:80 at okhttp3.internal.io.RealConnection.connectSocket(RealConnection.java:187) at okhttp3.internal.io.RealConnection.buildConnection(RealConnection.java:170) at okhttp3.internal.io.RealConnection.connect(RealConnection.java:111) at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:187) at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:123) at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:93) at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:296) at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:248) at okhttp3.RealCall.getResponse(RealCall.java:243) at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201) at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212) at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:190) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163) at okhttp3.RealCall.execute(RealCall.java:57) at retrofit2.OkHttpCall.execute(OkHttpCall.java:174) at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171) at rx.internal.operators.OperatorSubscribeOn$1$1$1.request(OperatorSubscribeOn.java:80) at rx.Subscriber.setProducer(Subscriber.java:209) at rx.internal.operators.OperatorSubscribeOn$1$1.setProducer(OperatorSubscribeOn.java:76) 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:50) at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) at rx.Observable.unsafeSubscribe(Observable.java:8460) at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) at rx.intern

weigg520 commented 6 years ago

@akarnokd

akarnokd commented 6 years ago

@weigg520 Why would you "at" me about a stack dump lacking context, reproduction code or any details on an RxJava version no longer supported?

yan962868635 commented 2 years ago

请教问题是如何解决的 Ask how the problem is solved