tinode / tindroid

Tinode chat client application for Android
Apache License 2.0
347 stars 190 forks source link

Broken Pipe when i try to send big file (file >100kb approximatly) to another user over chat. #23

Closed VirgileDjimgou closed 5 years ago

VirgileDjimgou commented 5 years ago

i got always a Broken Pipe bugs when i try to send big file (file >100kb approximatly) to another user over chat. here ist the printStackTrace() for Exception that i got :

E/MessageFragment: Failed to attach file java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:112) at java.net.SocketOutputStream.write(SocketOutputStream.java:157) 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.RetryableSink.writeToSocket(RetryableSink.java:78) at com.android.okhttp.internal.http.HttpConnection.writeRequestBody(HttpConnection.java:240) at com.android.okhttp.internal.http.HttpTransport.writeRequestBody(HttpTransport.java:56) at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:778) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:463) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:521) at co.tinode.tinodesdk.LargeFileHelper.upload(LargeFileHelper.java:78) at com.android.gudana.tindroid.MessagesFragment.doUpload(MessagesFragment.java:1337) at com.android.gudana.tindroid.MessagesFragment.access$1000(MessagesFragment.java:130) at com.android.gudana.tindroid.MessagesFragment$FileUploader.loadInBackground(MessagesFragment.java:1213) at com.android.gudana.tindroid.MessagesFragment$FileUploader.loadInBackground(MessagesFragment.java:1177) at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:306) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:59) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:47) at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:138) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:776)

Release Android Version : v0.15.8-rc1

Server Side : linux Ubuntu 16.04 version of tinode server, : v0.15.8-rc1' database backend : mysql.

Client-side Tindroid: Android app: Android API level ( 25 , 24 , 27).

the class responsible for the exception is this one : LargeFileHelper.java line 78 . I get a wrong answer from the remote server and the client close the connection in finally block " conn.disconnect();"

on Server Side maybe i must increase the size of file or the handler ....

// Large media/blob handlers.
"media": {
    // Media handler to use
    "use_handler": "fs",
    // Maximum size of uploaded file (8MB here for testing, maybe increase to 100MB = 104857600 in prod)
    "max_size": 104857600,
    // Garbage collection periodicity in seconds
    "gc_period": 60,
    // Number of unused entries to delete in one pass
    "gc_block_size": 100,
    // Configurations for various handlers.
    "handlers": {
        // File system storage.
        "fs": {
            // File system location to store uploaded files. In case of a cluster it
            // must be accessible by all cluster members, i.e. a network drive.
            "upload_dir": "uploads"
        },
        }
    }
},

any idea of ​​the cause of this error ....

VirgileDjimgou commented 5 years ago

on Server Side i get this message "2018/11/16 13:24:16 media upload 405 operation or method not allowed capture_beweis

or-else commented 5 years ago

Fixed: https://github.com/tinode/tindroid/commit/8580ff1a8b559447416e1a4949a972f924c94c67

VirgileDjimgou commented 5 years ago

Thank you man . after the change that you are suggested , it seems to be working fine now ...:)