Skip to content
This repository has been archived by the owner on Sep 21, 2018. It is now read-only.

SignalR throws Exceptions in its own threads which aren't handled #44

Closed
arnoldpistorius opened this issue Nov 18, 2014 · 0 comments
Closed

Comments

@arnoldpistorius
Copy link

Hi,

It appears that the SignalR connection throws unhandled exceptions inside its thread. There is no way to handle them in my application except for defining a global Thread.UncaughtExceptionHandler. This also affects my own threads, so this is not really the greatest solution. The exceptions occur mostly when I call the hubConnection.stop() method. Below I have included an example of Exceptions thrown by the connection Thread (an IndexOutOfBoundsException is also thrown sometimes, I will add the stacktrace when it occurs again):

11-18 11:06:07.998  24889-26148/com.mypackage E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-5420
    Process: com.mypackage, PID: 24889
    java.lang.NullPointerException: Attempt to read from field 'int com.android.okio.Segment.limit' on a null object reference
            at com.android.okio.OkBuffer.write(OkBuffer.java:574)
            at com.android.okio.OkBuffer.read(OkBuffer.java:610)
            at com.android.okio.RealBufferedSource.read(RealBufferedSource.java:53)
            at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.read(HttpConnection.java:495)
            at com.android.okhttp.internal.Util.skipAll(Util.java:227)
            at com.android.okhttp.internal.http.HttpConnection.discard(HttpConnection.java:212)
            at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.close(HttpConnection.java:536)
            at com.android.okhttp.internal.Util.closeQuietly(Util.java:97)
            at com.android.okhttp.internal.http.HttpEngine.close(HttpEngine.java:433)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.disconnect(HttpURLConnectionImpl.java:113)
            at microsoft.aspnet.signalr.client.http.java.NetworkRunnable.closeStreamAndConnection(NetworkRunnable.java:106)
            at microsoft.aspnet.signalr.client.http.java.NetworkRunnable.run(NetworkRunnable.java:95)
            at java.lang.Thread.run(Thread.java:818)

It would be nice if the exceptions inside threads are handled.

Thanks :)

Edit (added IndexOutOfBoundsException):

11-18 11:29:58.996  30513-31434/com.mypackage E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-5682
    Process: com.mypackage, PID: 30513
    java.lang.ArrayIndexOutOfBoundsException
            at com.android.okio.Util.checkOffsetAndCount(Util.java:29)
            at com.android.okio.OkBuffer.skip(OkBuffer.java:391)
            at com.android.okio.OkBuffer.readUtf8Line(OkBuffer.java:331)
            at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:96)
            at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.readChunkSize(HttpConnection.java:508)
            at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.read(HttpConnection.java:491)
            at com.android.okhttp.internal.Util.skipAll(Util.java:227)
            at com.android.okhttp.internal.http.HttpConnection.discard(HttpConnection.java:212)
            at com.android.okhttp.internal.http.HttpConnection$ChunkedSource.close(HttpConnection.java:536)
            at com.android.okhttp.internal.Util.closeQuietly(Util.java:97)
            at com.android.okhttp.internal.http.HttpEngine.close(HttpEngine.java:433)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.disconnect(HttpURLConnectionImpl.java:113)
            at microsoft.aspnet.signalr.client.http.java.NetworkRunnable.closeStreamAndConnection(NetworkRunnable.java:106)
            at microsoft.aspnet.signalr.client.http.java.NetworkRunnable.run(NetworkRunnable.java:95)
            at java.lang.Thread.run(Thread.java:818)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant