-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Upload often fails or gets stuck, especially when uploading 3 or more pictures #5128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@nicolas-raoul This seems to be an interesting issue to solve. Willing to work on it. |
@ayushanand308 Are you planning to apply for Google Summer of Code, by any chance? |
@nicolas-raoul Yes I am! |
@ayushanand308 Then please the instructions at https://github.com/commons-app/commons-app-documentation/blob/master/android/Students.md, at the "Fix 1 bug" step please choose a different bug, because this one is among the bugs that make the GSoC's task itself :-) How about #5057 for instance? Thank you for your interest! |
Hey Ayush, I would like to contribute to this issue along with you for GSOC 2023.....Can we connect? |
This error occurs when the app sends the "Failed to Upload" notification. The error is thrown at line 227 in UploadClient.java in the upload package This happens when the condition uploadResult.getUpload() == null evaluates to true at line 223 Here uploadResult is of type UploadResponse So uploadResult.getUpload() returns the nullable property upload of type UploadResult which is a data class At line 221 in UploadClient.java the value of a gson.fromJson() call is stored in the uploadResult field So uploadResult.getUpload() == null indicates that the upload property was returned as null by gson after parsing a JSON response from the server, which indicates that the server likely returned an empty or null response, As uploadResult.getUpload() == null is true, an exception of type MwException is thrown. The getErrorCode() method in MwException class returns error.getCode() where error is of type MwServiceError A top-level comment in MwServiceError.java says "Gson POJO for a MediaWiki API error" The class MwServiceError extends ServiceError which likely represents an error reported by the server via the API. It says "The API reported an error in the payload." All this happens when the uploadClient.uploadFileFromStash() method is called at line 296 in UploadWorker.kt As the uploadClient.uploadFileFromStash() call causes an exception the onErrorReturn { } block is executed. A null value is passed here which causes the NullPointerException as shown in the Logcat screenshot attached first. The exact error message is as below The message Could not acquire locks on server rdb1 indicates that this is likely a problem with the server, rather than the Android client. Two key methods are executed during the process in UploadWorker.kt:
while uploadFileToStash() turns out to be executed without a problem, uploadFileFromStash() causes the exception. So what is Stash? I'm still unsure what it is. But it is clear that it's something the server handles. Refer https://www.mediawiki.org/wiki/Manual:UploadStash I tried uploading multiple times and ended up with the exact same error. @nicolas-raoul here are my findings about this issue. Discussing with the maintainers of Wikimedia Android Data Client and the API developers would be very helpful in solving this issue. |
Stashing is a way to first send the picture's JPEG bytes to the server, then finalize the "upload" (file registration) a bit later. |
Steps to reproduce the error:
@nicolas-raoul Can you verify if the behavior is the same for you? |
@siva-subramaniam-v Does step 3 happen for you every time after steps 1 and 2? For me, after steps 1 and 2, step 3 sometimes happens. |
When I tested yesterday after step 2 the notification message changed from "Uploading file: file-name" to "Finishing uploading file-name" and then to step 3 ("Failed to upload file-name"). But this sequence happens consistently for me and leads to the same error. What else happens for you after step 2 other than step 3? |
@siva-subramaniam-v For me after step 2 upload is usually successful. If I understand correctly, multi-upload never works for you? If yes, would you mind creating a new GitHub issue? Thank you! 🙂 |
I just got upload stuck but uploading several medium-size sets (10 sets of 2 to 10 pictures). |
Hi @nicolas-raoul, could you please share the logs too (with the device unplugged)? |
Solved by Ritika. :-) |
Steps to reproduce:
Good 2G 450kbps↓ 150kbps↑
.Share
, then select the Commons app.Many other apps always upload reliably (for instance Gmail with attachments) even with slow Internet connections, even the Commons browser-based uploader seems to perform better, so hopefully we can fix this.
Possible strategy:
Measuring improvements:
Some uploads get stuck (no progress despite the progress bar showing an animation). Among those stuck, some file have actually been uploaded already, some not.
Aggravating factors:
Recent Google Play comments:
The text was updated successfully, but these errors were encountered: