Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
-
android : 6.0.1
cordova-android : 6.2.3
cordova-plugin-file-transfer : 1.6.3
Description
I have troubles uploading a video (potentially heavy file) to a PHP API endpoint, with chunkedMode enabled.
It ends up to a javax.net.ssl.SSLException:
Write error: ssl=0x9c9050c0: I\/O error during system call, Broken pipe
Can't figure out if this is due to a misconfiguration either client-side or server-side?
Here is the code I execute (JS - cordova) :
const options = new FileUploadOptions(); options.fileKey = 'video'; options.fileName = 'VID_20170721_161557.mp4'; options.mimeType = 'video/mp4'; options.chunkedMode = true; options.httpMethod = 'POST'; options.headers = { Authorization: 'Bearer xxxxxx.yyyyyy.zzzzzz' }; const uploader = new FileTransfer(); uploader.onprogress = (progressEvent) => { console.log('progress', progressEvent); }; // Launch the upload uploader.upload('cdvfile://localhost/sdcard/DCIM/Camera/VID_20170721_161557.mp4', encodeURI('https://domain.tld/api/v1/videos/upload'), (response) => { console.log('SUCCESS!', response); }, (error) => { console.error('FAIL...', error); }, options);
Here are the complete logs from Android Studio :
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: upload cdvfile://localhost/sdcard/DCIM/Camera/VID_20170721_161557.mp4 to https://domain.tld/api/v1/videos/upload
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: fileKey: video
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: fileName: VID_20170721_161557.mp4
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: mimeType: video/mp4
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: params: {}
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: trustEveryone: false
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: chunkedMode: true
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: headers: null
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: objectId: 6
09-29 16:46:31.905 4208-4429/_APP_ID_ D/FileTransfer: httpMethod: POST
09-29 16:46:31.911 4208-3275/_APP_ID_ D/FileTransfer: Content Length: 9199611
09-29 16:46:31.987 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 114806 of 9199611 bytes
09-29 16:46:32.002 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 229494 of 9199611 bytes
09-29 16:46:32.027 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 344182 of 9199611 bytes
09-29 16:46:33.008 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 458870 of 9199611 bytes
09-29 16:46:34.011 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 573558 of 9199611 bytes
09-29 16:46:35.061 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 688246 of 9199611 bytes
09-29 16:46:36.070 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 802934 of 9199611 bytes
09-29 16:46:37.051 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 917622 of 9199611 bytes
09-29 16:46:38.076 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1032310 of 9199611 bytes
09-29 16:46:39.501 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1146998 of 9199611 bytes
09-29 16:46:40.028 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1261686 of 9199611 bytes
09-29 16:46:41.070 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1376374 of 9199611 bytes
09-29 16:46:42.071 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1491062 of 9199611 bytes
09-29 16:46:43.046 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1605750 of 9199611 bytes
09-29 16:46:44.011 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1720438 of 9199611 bytes
09-29 16:46:45.033 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1835126 of 9199611 bytes
09-29 16:46:46.030 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 1949814 of 9199611 bytes
09-29 16:46:47.011 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2064502 of 9199611 bytes
09-29 16:46:48.623 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2179190 of 9199611 bytes
09-29 16:46:48.713 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2293878 of 9199611 bytes
09-29 16:46:49.280 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2408566 of 9199611 bytes
09-29 16:46:50.249 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2523254 of 9199611 bytes
09-29 16:46:51.694 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2637942 of 9199611 bytes
09-29 16:46:52.257 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2752630 of 9199611 bytes
09-29 16:46:53.247 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2867318 of 9199611 bytes
09-29 16:46:54.271 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 2982006 of 9199611 bytes
09-29 16:46:55.308 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3096694 of 9199611 bytes
09-29 16:46:56.320 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3211382 of 9199611 bytes
09-29 16:46:57.314 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3326070 of 9199611 bytes
09-29 16:46:58.807 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3440758 of 9199611 bytes
09-29 16:46:59.324 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3555446 of 9199611 bytes
09-29 16:47:00.309 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3670134 of 9199611 bytes
09-29 16:47:01.294 4208-3275/_APP_ID_ D/FileTransfer: Uploaded 3784822 of 9199611 bytes
09-29 16:47:02.031 4208-3275/_APP_ID_ W/FileTransfer: Error getting HTTP status code from connection.
java.lang.IllegalStateException: closed
at com.android.okhttp.okio.RealBufferedSink.emit(RealBufferedSink.java:181)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:761)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:443)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:501)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at org.apache.cordova.filetransfer.FileTransfer.createFileTransferError(FileTransfer.java:652)
at org.apache.cordova.filetransfer.FileTransfer.access$600(FileTransfer.java:69)
at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:553)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
09-29 16:47:02.032 4208-3275/_APP_ID_ E/FileTransfer: {"code":3,"source":"cdvfile:\/\/localhost\/sdcard\/DCIM\/Camera\/VID_20170721_161557.mp4","target":"https:\/\/domain.tld\/api\/v1\/videos\/upload","http_status":0,"exception":"Write error: ssl=0x9c9050c0: I\/O error during system call, Broken pipe"}
javax.net.ssl.SSLException: Write error: ssl=0x9c9050c0: I/O error during system call, Broken pipe
at com.android.org.conscrypt.NativeCrypto.SSL_write(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl$SSLOutputStream.write(OpenSSLSocketImpl.java:771)
at com.android.okhttp.okio.Okio$1.write(Okio.java:76)
at com.android.okhttp.okio.AsyncTimeout$1.write(AsyncTimeout.java:155)
at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
at com.android.okhttp.okio.RealBufferedSink.write(RealBufferedSink.java:46)
at com.android.okhttp.internal.http.HttpConnection$ChunkedSink.write(HttpConnection.java:339)
at com.android.okhttp.okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:176)
at com.android.okhttp.okio.RealBufferedSink$1.write(RealBufferedSink.java:198)
at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:479)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
09-29 16:47:02.032 4208-3275/_APP_ID_ E/FileTransfer: Failed after uploading 3899510 of 9199611 bytes.
It seems the error always comes avec 30s, is it related to any timeout?
(Might be some server-side timeout)
What I don't exactly understand is why, when I disable the chunkedMode, it works without any problem?