tus / tus-android-client

The tus client for Android.
https://tus.io/
161 stars 46 forks source link

Internal Error #5

Closed shreyaj closed 8 years ago

shreyaj commented 8 years ago

I downloaded the android client and tried to run the app on my Samsung S3 (V 4.1) and it keeps giving the 400 internal error every time I click on abort and also when the upload is at 100%. This is happening on all pre-lollipop devices. How can I make it work?

Acconut commented 8 years ago

This seems weird and should not happen. Thanks for reporting this. Unfortunately, I was not able to reproduce this issue on my own. Could you please provide more details? It would be very helpful if you can find some application logs or network capture! And do you mean a 400 Bad Request or 500 Internal Error status code?

Acconut commented 8 years ago

I found a bug in which the server returns a 405 Method Not Allowed. Could it be that you meant this error?

shreyaj commented 8 years ago

This is the error I am getting (on pre lollipop phones):

12-27 22:01:15.723 5257-5325/com.fibergrid.foam W/System.err: io.tus.java.client.ProtocolException: unexpected status code (400) while uploading chunk 12-27 22:01:15.723 5257-5325/com.fibergrid.foam W/System.err: at io.tus.java.client.TusUploader.finish(TusUploader.java:131) 12-27 22:01:15.724 5257-5325/com.fibergrid.foam W/System.err: at com.fibergrid.foam.MainActivity$3.run(MainActivity.java:267) 12-27 22:01:15.724 5257-5325/com.fibergrid.foam W/System.err: at java.lang.Thread.run(Thread.java:841)

I am getting it on line uploader.finish();

Acconut commented 8 years ago

Great, thanks. I believe I have found the issue and a fix should be available. Actually, this is not a problem with tus-android-client but actually tus-java-client. Nevertheless, please try tus-java-client 0.1.4 (https://github.com/tus/tus-java-client/releases/tag/0.1.4) which should contain a fix and is already available on JCenter.

shreyaj commented 8 years ago

Getting this error now on line TusUploader uploader = client.resumeOrCreateUpload(upload);

12-28 11:24:19.448 13492-13523/com.fibergrid.foam W/System.err: io.tus.java.client.ProtocolException: unexpected status code (404) while resuming upload 12-28 11:24:19.449 13492-13523/com.fibergrid.foam W/System.err: at io.tus.java.client.TusClient.resumeUpload(TusClient.java:162) 12-28 11:24:19.449 13492-13523/com.fibergrid.foam W/System.err: at io.tus.java.client.TusClient.resumeOrCreateUpload(TusClient.java:186) 12-28 11:24:19.449 13492-13523/com.fibergrid.foam W/System.err: at com.fibergrid.foam.MainActivity$3.run(MainActivity.java:253) 12-28 11:24:19.449 13492-13523/com.fibergrid.foam W/System.err: at java.lang.Thread.run(Thread.java:841)

And the file name on the server is being randomly generated. How can I make sure the file name is the same even when it is stored on the tus server?

shreyaj commented 8 years ago

I got the above mentioned exception twice but it is working now. The files are being uploaded to the server without any problem. However, the file name on the server is being randomly generated. How can I make sure the file name is the same even when it is stored on the tus server? Thank you!

Acconut commented 8 years ago

I apologize for my delayed response since I was not able to work on this project in the past week. Anyway, I am pleased to hear that you were able to resolve the issues.

How can I make sure the file name is the same even when it is stored on the tus server?

There is no easy answer to this question since the tus protocol takes a more abstract approach on the topic of how files are stored on the server by not making any assumption about the underlying storage system. The only possibility is that you control the remote server. In this case you can send the filename using the optional meta data extension (see io.tus.java.client.TusUploader#getMetadata) and then set the appropriated filename on the server-side. If you are looking at tusd, I have to let you down since this functionality is not implemented there.

hanjun-lin commented 8 years ago

Hi @shreyaj and @Acconut, I also have the same problem of client side do not know about the new file name of uploaded file. I post a new issue (it's also a new feature request) on tud https://github.com/tus/tusd/issues/44

hanjun-lin commented 8 years ago

Current latest version of client sides' (Java and Android) sample code are solve the problem of knowing about the new file name of uploaded file. But I also face the Internal Error problem when the the mobile network (4G) is not stable. I am try to reproduce the problem. After I figure out. I will report here.

Acconut commented 8 years ago

But I also face the Internal Error problem when the the mobile network (4G) is not stable. I am try to reproduce the problem. After I figure out. I will report here.

This is probably due to timeouts. The clients should default to retry the upload which is a feature I am currently developing.

Acconut commented 8 years ago

The 0.3.0 release of the tus-java-client includes the new TusExecutor class which provides an easy way for implementing retries. Please consult the libraries' README for more information (https://github.com/tus/tus-java-client#usage).

giaur500 commented 7 years ago

This is still an issue with latest TUS Android client version. Everything is fine on Lollipop and newer. But I'm experiencing "Unexpected status code 400 while uploading chunk" response from tus server on KitKat. Tested with unmodified official Android sample.

Is there any workaround?

Acconut commented 7 years ago

@giaur500 I am not able to reproduce your issue using Android 4.4.2 inside an emulator. Do you have access to the server logs to get more details?

giaur500 commented 7 years ago

This seems to be an issue with our server only. But it's weird I have no problems on Android > 4.4. I will try to access server logs

Acconut commented 7 years ago

Could it be a problem related to a possible SSL setup? Maybe KitKat relies on a chipher which is not supported by your server anymore?

giaur500 commented 7 years ago

Maybe it could be a reason, thanks for tip. I will test my server without ssl enabled to be sure.

rajan-d commented 6 years ago

Getting this error now on line TusUploader uploader = client.resumeOrCreateUpload(upload);

03-28 14:15:02.567 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: io.tus.java.client.ProtocolException: unexpected status code (404) while creating upload 03-28 14:15:02.567 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at io.tus.java.client.TusClient.createUpload(TusClient.java:151) 03-28 14:15:02.577 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at io.tus.java.client.TusClient.resumeOrCreateUpload(TusClient.java:232) 03-28 14:15:02.577 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at com.yourappsindia.dempabackuptesting.HomeActivity$4.makeAttempt(HomeActivity.java:225) 03-28 14:15:02.577 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at io.tus.java.client.TusExecutor.makeAttempts(TusExecutor.java:83) 03-28 14:15:02.577 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at com.yourappsindia.dempabackuptesting.HomeActivity.sendFile(HomeActivity.java:253) 03-28 14:15:02.577 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at com.yourappsindia.dempabackuptesting.HomeActivity$5.onResponse(HomeActivity.java:325) 03-28 14:15:02.587 16311-16311/com.yourappsindia.dempabackuptesting W/System.err: at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)

i am getting this error on file upload. Any help will be appreciated.

Acconut commented 6 years ago

@rajan-d Could you please open a new issue on GitHub with details about your setup, especially the used tus server and the responsible code?