Okhttp version: 3.3.1
Received crash report from HUAWEI TAG-AL100 on Android 5.1.
Stacktrace
1Caused by: java.lang.IllegalArgumentException: sockaddrToInetAddress unsupported ss_family: 0
2 at libcore.io.Posix.getsockname(Native Method)
3 at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:87)
4 at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:681)
5 at libcore.io.IoBridge.closeAndSignalBlockedThreads(IoBridge.java:220)
6 at java.net.PlainSocketImpl.close(PlainSocketImpl.java:153)
7 at java.net.Socket.close(Socket.java:328)
8 at okhttp3.internal.Util.closeQuietly(Util.java:105)
9 at okhttp3.ConnectionPool.cleanup(ConnectionPool.java:226)
10 at okhttp3.ConnectionPool$1.run(ConnectionPool.java:59)
11 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
12 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
13 at java.lang.Thread.run(Thread.java:818)
We should consider handling similarly to other firmware bugs
/**
* Returns true if {@code e} is due to a firmware bug fixed after Android 4.2.2.
* https://code.google.com/p/android/issues/detail?id=54072
*/
public static boolean isAndroidGetsocknameError(AssertionError e) {
return e.getCause() != null && e.getMessage() != null
&& e.getMessage().contains("getsockname failed");
}
Dupe of https://github.com/square/okhttp/issues/3345, but not sure we want all developers to have to implement their own Dns and SocketFactory to avoid crashes not caused by them.
The argument against handling this, is that it can pop up literally anywhere in the OkHttp client, and it probably does. Unless we wrap Dns, and Socket always (potentially hurting perf) then there may not be an adequate fix.
Closing as we don't have strong enough public signal to patch around this Phone Vendor bug.