okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

Absurd number of threads while connecting disconnecting websocket

Open sohailbud opened this issue 10 years ago • 2 comments

Crash report attached from a user's phone and there were 614 threads at the time of crash.

I tried reproducing the error and it doesn't crash but I do see a lot threads being created while I connect and disconnect from network. Every time call.enqueue(webSocketListener) is hit, two new threads are being created which are never destroyed.

Thread Name: OkHttp Connecti OkHttp Dispatch

Maybe I am doing something wrong, should I be destroying something while disconnecting?

com.sense.androidclient_issue_73_crash_57c0785e004400012dab6aef5b38d9eb.txt

sohailbud avatar Aug 29 '16 20:08 sohailbud

Yeah, you’re creating too many instances of OkHttpClient. This doc explains what you should do: https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html

swankjesse avatar Aug 29 '16 21:08 swankjesse

@swankjesse Should this issue be closed then?

gauravsak avatar Aug 30 '16 11:08 gauravsak