aspnetcore
aspnetcore copied to clipboard
Android SignalR Java Client - OnErrorNotImplementedException
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
Recently started having this issue after updating the lib from 3.0.0 to 6.0.8, I can't seem to reproduce it myself, but it's being reported on the crashlytics and is gaining momentum.
https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnection.java#L436-L442 appears to be an oversight in the SignalR client: subscribe() without error handling here.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
Fatal Exception: io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.lang.RuntimeException: java.net.SocketException: Socket closed at io.reactivex.rxjava3.internal.observers.EmptyCompletableObserver.onError(EmptyCompletableObserver.java:50) at io.reactivex.rxjava3.internal.operators.completable.CompletableAndThenCompletable$SourceObserver.onError(CompletableAndThenCompletable.java:62) at io.reactivex.rxjava3.internal.operators.completable.CompletableAndThenCompletable$NextObserver.onError(CompletableAndThenCompletable.java:104) at io.reactivex.rxjava3.internal.operators.completable.CompletableDoOnEvent$DoOnEvent.onError(CompletableDoOnEvent.java:64) at io.reactivex.rxjava3.subjects.CompletableSubject.onError(CompletableSubject.java:126) at com.microsoft.signalr.OkHttpWebSocketWrapper$SignalRWebSocketListener.onFailure(OkHttpWebSocketWrapper.java:141) at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.kt:592) at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:197) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923)
.NET Version
6.0.9
Anything else?
I think this is related to: https://github.com/dotnet/aspnetcore/issues/23820 Regression?
More info https://stackoverflow.com/questions/73754257/android-signalr-java-client-onerrornotimplementedexception
Looking at your code on stackoverflow, you have
this.connection.stop()
.andThen {
_connectionState.postValue(HubConnectionState.DISCONNECTED)
disposeHubServices()
cancelRefreshTokenJob()
it.onComplete()
Timber.d("disconnected")
}
which is likely where the error isn't being handled.
Hi @fi8er1. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I have managed to solve this issue:
My hub stop subscribe method was missing the onError in a fragment. I added it like:
hub.stop().subscribe({},{ Timber.d(it) })
and the issue is gone now....