Open alexandersokol opened 1 year ago
UPD: Add some logs to the parse client and found out that I'm receiving socketTimeout Exception exactly at the moment when file uploading progress reaches 100%.
adding huge write timeout has no effect
val client = OkHttpClient.Builder()
.writeTimeout(5, TimeUnit.MINUTES)
08-11 22:27:36.678 23442 24003 E PARSE : java.net.SocketTimeoutException: timeout
08-11 22:27:36.678 23442 24003 E PARSE : at okio.SocketAsyncTimeout.newTimeoutException(JvmOkio.kt:143)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.AsyncTimeout.access$newTimeoutException(AsyncTimeout.kt:162)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:335)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParsePlugins.lambda$restClient$0$com-parse-ParsePlugins(ParsePlugins.java:156)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParsePlugins$$ExternalSyntheticLambda0.intercept(Unknown Source:2)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
08-11 22:27:36.678 23442 24003 E PARSE : at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParseHttpClient.executeInternal(ParseHttpClient.java:66)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParseHttpClient.execute(ParseHttpClient.java:52)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParseRequest.lambda$sendOneRequestAsync$0$com-parse-ParseRequest(ParseRequest.java:148)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.ParseRequest$$ExternalSyntheticLambda1.then(Unknown Source:8)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.lambda$completeAfterTask$9(Task.java:500)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task$$ExternalSyntheticLambda2.run(Unknown Source:8)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:109)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.completeAfterTask(Task.java:492)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.continueWithTask(Task.java:775)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.continueWithTask(Task.java:786)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.lambda$onSuccessTask$15(Task.java:879)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task$$ExternalSyntheticLambda7.then(Unknown Source:4)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task.lambda$completeAfterTask$9(Task.java:500)
08-11 22:27:36.678 23442 24003 E PARSE : at com.parse.boltsinternal.Task$$ExternalSyntheticLambda2.run(Unknown Source:8)
08-11 22:27:36.678 23442 24003 E PARSE : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
08-11 22:27:36.678 23442 24003 E PARSE : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
08-11 22:27:36.678 23442 24003 E PARSE : at java.lang.Thread.run(Thread.java:920)
08-11 22:27:36.678 23442 24003 E PARSE : Caused by: java.net.SocketException: Socket closed
08-11 22:27:36.678 23442 24003 E PARSE : at java.net.SocketInputStream.read(SocketInputStream.java:209)
08-11 22:27:36.678 23442 24003 E PARSE : at java.net.SocketInputStream.read(SocketInputStream.java:144)
08-11 22:27:36.678 23442 24003 E PARSE : at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readFromSocket(ConscryptEngineSocket.java:945)
08-11 22:27:36.678 23442 24003 E PARSE : at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:909)
08-11 22:27:36.678 23442 24003 E PARSE : at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.readUntilDataAvailable(ConscryptEngineSocket.java:824)
08-11 22:27:36.678 23442 24003 E PARSE : at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.read(ConscryptEngineSocket.java:797)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.InputStreamSource.read(JvmOkio.kt:90)
08-11 22:27:36.678 23442 24003 E PARSE : at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
08-11 22:27:36.678 23442 24003 E PARSE : ... 37 more
New Issue Checklist
Issue Description
Hello! I faced an issue when attached to an object file is uploaded several times. Previously users reported an issue that some of them have an "infinite uploading spinner" on the screen. We decided to add progress and found this problem.
We have the following structure of the objects:
Video:
So to get the uploading progress the idea was to upload files first and calculate the average by taking the progress data callback of each file.
The code:
For the previewFile & videoFile progress should be in the range [0..200] so the progress value should be [0..100], but it is out of range (see logs below)
The suspendSave extension is pretty much the same that ParseSDK-ktx uses but with a callback
Pretty sure that callbacks are not the best option for the coroutine suspend functions, but I believe that is has no effect on this issue.
Steps to reproduce
Create ParseFile and save it with a progress callback, put the saved file into a new ParseObject, and save the object. It isn't reproducing on the object that doesn't have nested ParseObjects inside like Image and mostly with files larger than 20MB. It isn't reproducing with a 100% chance, once it can happen when uploading is the first action user does and in another case (more frequently) when a user removes the video object before uploading (references, file paths of a new and an old object are different).
Actual Outcome
ParseFile uploads several times.
Expected Outcome
ParseFile uploads once, calling save() on an object doesn't trigger uploading files again.
Environment
AGP: 7.2.1 kotlin: 1.7.10 coroutines: 1.6.3
Parse Android SDK
4.0.0
12
Server
4.2.0
no info
no info
Database
no info
no info
no info
Logs
total progress output:
Files uploading log: