error stack:
1 java.net.Socket.getInputStream(Socket.java:894)
2 okio.Okio.okio.Source source(java.net.Socket)(Okio.java:220)
3 okhttp3.internal.connection.RealConnection.void connectSocket(int,int)(RealConnection.java:226)
4 okhttp3.internal.connection.RealConnection.void connect(int,int,int,boolean)(RealConnection.java:146)
5 okhttp3.internal.connection.StreamAllocation.okhttp3.internal.connection.RealConnection findConnection(int,int,int,boolean)(StreamAllocation.java:186)
6 okhttp3.internal.connection.StreamAllocation.okhttp3.internal.connection.RealConnection findHealthyConnection(int,int,int,boolean,boolean)(StreamAllocation.java:121)
7 okhttp3.internal.connection.StreamAllocation.okhttp3.internal.http.HttpCodec newStream(okhttp3.OkHttpClient,boolean)(StreamAllocation.java:100)
8 okhttp3.internal.connection.ConnectInterceptor.okhttp3.Response intercept(okhttp3.Interceptor$Chain)(ConnectInterceptor.java:42)
9 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request,okhttp3.internal.connection.StreamAllocation,okhttp3.internal.http.HttpCodec,okhttp3.Connection)(RealInterceptorChain.java:92)
10 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request)(RealInterceptorChain.java:67)
11 okhttp3.internal.cache.CacheInterceptor.okhttp3.Response intercept(okhttp3.Interceptor$Chain)(CacheInterceptor.java:93)
12 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request,okhttp3.internal.connection.StreamAllocation,okhttp3.internal.http.HttpCodec,okhttp3.Connection)(RealInterceptorChain.java:92)
13 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request)(RealInterceptorChain.java:67)
14 okhttp3.internal.http.BridgeInterceptor.okhttp3.Response intercept(okhttp3.Interceptor$Chain)(BridgeInterceptor.java:93)
15 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request,okhttp3.internal.connection.StreamAllocation,okhttp3.internal.http.HttpCodec,okhttp3.Connection)(RealInterceptorChain.java:92)
16 okhttp3.internal.http.RetryAndFollowUpInterceptor.okhttp3.Response intercept(okhttp3.Interceptor$Chain)(RetryAndFollowUpInterceptor.java:120)
17 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request,okhttp3.internal.connection.StreamAllocation,okhttp3.internal.http.HttpCodec,okhttp3.Connection)(RealInterceptorChain.java:92)
18 okhttp3.internal.http.RealInterceptorChain.okhttp3.Response proceed(okhttp3.Request)(RealInterceptorChain.java:67)
19 okhttp3.RealCall.okhttp3.Response getResponseWithInterceptorChain()(RealCall.java:179)
20 okhttp3.RealCall$AsyncCall.void execute()(RealCall.java:129)
21 okhttp3.internal.NamedRunnable.void run()(NamedRunnable.java:32)
22 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
23 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
24 java.lang.Thread.run(Thread.java:761)
environ: Android 7.0 samsung SM-G9350 , xiaomi mi5 Android 7.0 and other android 7.0.
okhttp3,3.6.0
Executable test case to reproduce the problem?
Seeing the same exact crash for a handful of users, mostly on Samsung S7 line devices. Unfortunately I'm unable to reproduce and due to the stacktrace, not even sure where it's coming from on my side. I'll let you know if I'm able to reproduce or find the origin.
I think you probably want to report this to Samsung. It鈥檚 likely an issue with that device that you鈥檒l probably see on any HTTP client.

tracking this bug a week(about 2,004 user crash), most crash at huawei phone,other is samsung,xiaomi , all in android 7.0 .
FYI @15characterlimi
No action for us to take on this.
This is a known bug in Android 7.0; it was fixed by this change which went into Android 7.1:
https://android-review.googlesource.com/#/c/271775/
I'm very sorry that we found it too late for Android 7.0 and that you ran into it.
The issue is that Android 7.0's PrivilegedActionException.getException() returns null, so places that do:
throw privilegedActionException.getException()
will attempt to throw a null value. There are 19 such places in Android N; sadly, this is one of them. :-( I plan to take appropriate measures to make vendors aware of this issue and the patch.
PS. I should add that the NullPointerException from this Android bug masks some other Exception that would normally be thrown at affected places in the code. In the particular example of Socket, in cases where Socket.getInputStream() or getOutputStream() should throw IOException but the socket was still open at the start of that method being called, then the IOException will be swallowed and replaced by the NullPointerException that you have observed. :(
We could fix the callsite to catch NPE and rethrow an IOException. Lemme see what that looks like.
thanks.
Such a workaround could work, but should probably be specific to the kind of "throw with null exception" kind of NPE. Let me know how you go / whether you need help.
@15characterlimi i send email to [email protected] report this bug. i think under ideal conditions this exception case by some rom, unnecessary throw null exception.
Most helpful comment
tracking this bug a week(about 2,004 user crash), most crash at huawei phone,other is samsung,xiaomi , all in android 7.0 .