I haven't figured out a way to reproduce this. But this happens once in a while using fetch(). I'm trying to find a way to reproduce. Will update the issue then. This is the trace I'm getting. Does this ring a bell for anyone?
E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.company.app, PID: 4508
java.lang.IllegalStateException: closed
at okio.RealBufferedSink.write(RealBufferedSink.java:39)
at okio.ForwardingSink.write(ForwardingSink.java:35)
at com.facebook.react.modules.network.ProgressRequestBody$1.write(ProgressRequestBody.java:58)
at okio.RealBufferedSink.flush(RealBufferedSink.java:216)
at com.facebook.react.modules.network.ProgressRequestBody.writeTo(ProgressRequestBody.java:48)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
at okhttp3.RealCall.access$100(RealCall.java:33)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
0.37I can't reproduce this either. I think it will be hard to make progress unless we do have a way to repro, so I am going to close this issue. If you find a way to reproduce it then please feel free to reopen!
@locly you try to using axios and stetho, open chrome://inspect and try a http request, always crash.
I can reproduce it:
let url = APIs.DUANG_LOGIN;
console.log(url);
console.log(formData);
response = await fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
},
body: formData
});
data = await response.json();
console.log(data);
Fist Call:
-----------------------------------------------------------------------------------------------------------------------------D/wpa_supplicant( 1146): wlan0: Control interface command 'SIGNAL_POLL'
I/ReactNativeJS(19589): https://open.duangwifi.cn/v1/site/login
I/ReactNativeJS(19589): { _parts: [ [ 'username', 'demo' ], [ 'password', '123456' ] ] }
E/ReactNativeJS(19589): [TypeError: Network request failed]
E/unknown:React(19589): Network request failed, stack:
E/unknown:React(19589): onerror@193:13650
E/unknown:React(19589): value@185:1505
E/unknown:React(19589): value@184:6892
E/unknown:React(19589): value@184:3493
E/unknown:React(19589): <unknown>@184:9942
E/unknown:React(19589): value@76:1364
E/unknown:React(19589): value@30:2818
E/unknown:React(19589): <unknown>@30:1053
E/unknown:React(19589): d@30:127
E/unknown:React(19589): value@30:1025
--------------------------------------------------------------------------------------------------
Second Call:
--------------------------------------------------------------------------------------------------
I/ReactNativeJS(19589): https://open.duangwifi.cn/v1/site/login
I/ReactNativeJS(19589): { _parts: [ [ 'username', 'demo' ], [ 'password', '123456' ] ] }
E/AndroidRuntime(19589): FATAL EXCEPTION: OkHttp Dispatcher
E/AndroidRuntime(19589): Process: com.duanglink.bizappv3, PID: 19589
E/AndroidRuntime(19589): java.lang.IllegalStateException: closed
E/AndroidRuntime(19589): at okio.RealBufferedSink.write(RealBufferedSink.java:39)
E/AndroidRuntime(19589): at okio.ForwardingSink.write(ForwardingSink.java:35)
E/AndroidRuntime(19589): at com.facebook.react.modules.network.ProgressRequestBody$1.write(ProgressRequestBody.java:58)
E/AndroidRuntime(19589): at okio.RealBufferedSink.flush(RealBufferedSink.java:216)
E/AndroidRuntime(19589): at com.facebook.react.modules.network.ProgressRequestBody.writeTo(ProgressRequestBody.java:48)
E/AndroidRuntime(19589): at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
E/AndroidRuntime(19589): at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
E/AndroidRuntime(19589): at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
E/AndroidRuntime(19589): at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
E/AndroidRuntime(19589): at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
E/AndroidRuntime(19589): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
E/AndroidRuntime(19589): at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
E/AndroidRuntime(19589): at okhttp3.RealCall.access$100(RealCall.java:33)
E/AndroidRuntime(19589): at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
E/AndroidRuntime(19589): at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
E/AndroidRuntime(19589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(19589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(19589): at java.lang.Thread.run(Thread.java:818)
I/octvm_klo( 3003): klo lock
I/WtEventController( 1599): Receive am_crash event for pid: 19589
W/ActivityManager( 855): Force finishing activity com.duanglink.bizappv3/.MainActivity
I have same bug. I can not fix theme.
Same issue here.. Do you guys have any news on this ?
when Debug JS Remotely for a while it will happen
Seems link to #10423
any update on this?
Happens still while debugging on real android device
I had the same issue with OkHttp, It's related to the connection being kept alive, as a workaround you could close the connection on each call using 'Connection': 'close' header, hopefully it will be fixed soon.
Example:
fetch(backendAPI, { method: 'POST', headers: { 'Connection': 'close' }, body: data })
I was getting this today, app was working fine on some androids but not Galaxy S#
to fix:
open android/app/app.iml
change the following lines (bumping version for okhttp to 3.8)
<orderEntry type="library" exported="" name="com.squareup.okhttp3:okhttp:3.8.0@jar" level="project" />
<orderEntry type="library" exported="" name="com.squareup.okhttp3:okhttp-urlconnection:3.8.0@jar" level="project" />
and its working now
Most helpful comment
Same issue here.. Do you guys have any news on this ?