square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.87k stars 9.16k forks source link

okhttp-urlconnection3.10.0,存在socket句柄泄漏问题,当到达1000句柄时候APP会闪退 #4019

Closed xihuan22d closed 6 years ago

yschimke commented 6 years ago

Google Translate: Okhttp-urlconnection3.10.0, there is a socket handle leak problem, APP will flash back when it reaches 1000 handle

Please provide a reproducible test case.

xihuan22d commented 6 years ago

I write a demo to Reproduce the bug

https://github.com/xihuan22d/OKHttpBugTest

deltaguita commented 6 years ago

Only 3.10.0 ?

xihuan22d commented 6 years ago

below 3.10.0 also have this probelm

yschimke commented 6 years ago

You shouldn't be creating a new OkHttp client instance per request

https://github.com/xihuan22d/OKHttpBugTest/blob/master/app/src/main/java/com/my/okhttpbugtest/OkHttpUtils.java#L21

xihuan22d commented 6 years ago

ok,thanks