Skip to content

Sometimes uploads fails or queued, then don't upload. #1878

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

Closed
neslihanturan opened this issue Sep 4, 2018 · 29 comments
Closed

Sometimes uploads fails or queued, then don't upload. #1878

neslihanturan opened this issue Sep 4, 2018 · 29 comments

Comments

@neslihanturan
Copy link
Collaborator

Summary:

Our friend John Lubbock says, "I wonder if you know why when I upload photos on the Commons app, sometimes they say 'Failed' or 'queued', and don't upload?".

Device and Android version:
Samsung S9+

Commons app version:

2.8.2

Screen-shots:
image

Would you like to work on the issue?
^_^ no.

@misaochan
Copy link
Member

Where did John post, @neslihanturan ? I'd like to ask him about the method he used to upload (Nearby? Share? etc)

@neslihanturan
Copy link
Collaborator Author

I asked same question too, will update once the answer comes. He asked from twitter, I don't think he has a github account.

@neslihanturan
Copy link
Collaborator Author

He said contributions were from main screen.

@misaochan
Copy link
Member

Could you point us to the conversation on Twitter please?

@neslihanturan
Copy link
Collaborator Author

Do you mean, seeing screenshots from conversation?

@misaochan
Copy link
Member

Sorry, I'm not familiar with Twitter and didn't know you could send private messages on it - I thought he tweeted it, haha. If it's a private message then never mind. Could you ask him how often it happens for him, and if the queued pictures ever succeeded? Also, he has confirmed he is on 2.8.2?

@neslihanturan
Copy link
Collaborator Author

  • Yes he confirmed he is on 2.8.2 with about page screenshoot.
  • He said uploads don't succeed afterwards.
  • He said sometimes.

@misaochan
Copy link
Member

Yann posted in beta feedback:

Some files stay in the queue. I can't upload or remove them, except by uninstalling the application. File chosen from the gallery on Android. It happens repeatedly if a file already exists with the same name. AFAIK it only happens from 2.8. It happens even if I upload one file at a time.

Do you think the changes that we made to file uploads in 2.8 might be the culprit? @neslihanturan could you please ask John if he has a rough idea of when the problem started for him?

@misaochan
Copy link
Member

misaochan commented Oct 5, 2018

Wanted to bump this issue as we have another report on google groups:

Picture just ends up as queued.

The only thing shown is the file name all the other items are blank even though I filled them in. Anyway the whole app doesn't work here on Android 8.0. Bye.

@misaochan
Copy link
Member

misaochan commented Oct 6, 2018

Yann has informed me that v2.8.4 does not solve this problem for him. I have been talking to Jim Henderson, who reports a similar issue with queued uploads.

@neslihanturan , after you are done with your main UI PR, could you please go through your old PR with the file upload changes, and see if anything that you changed could have caused this?

I suggest you try with an Android 8.0 or 8.1 emulator. So far all of the reports appear to be from that version. I just need to confirm with Jim about his Android version

@misaochan misaochan mentioned this issue Oct 6, 2018
14 tasks
@Yannf
Copy link

Yannf commented Oct 6, 2018

FYI my Android version is 7.1.1, and it is the latest update on my J5. Thanks for trying to fix this, it is rather annoying. It seems to happen specifically when I upload the first picture in a series.

@misaochan
Copy link
Member

@Yannf Thanks for chiming in! Could you please elaborate on what you mean by "first picture in a series", by detailing the steps you take and the results? E.g.

  1. Open app, tapped gallery button, select picture, enter title/desc etc. Picture ends up queued forever.
  2. In app, tapped gallery button again shortly after that and selected another picture, entered title/desc. Picture upload succeeds

So on and so forth?

@Yannf
Copy link

Yannf commented Oct 7, 2018

If I upload several pictures successively, usually only the first fails. And it seems the App crashes (it closes without warning).

@misaochan
Copy link
Member

@ashishkumar468 Could you please work with @neslihanturan to solve this? It is our most urgent bug at the moment, so we will need this to be fixed in v2.9. You guys can contact @Yannf here on this thread, or Jim at Commons app talk , or others at our google group forums, if you need further information.

@ashishkumar468
Copy link
Collaborator

@misaochan Will take this up

@ashishkumar468
Copy link
Collaborator

ashishkumar468 commented Oct 8, 2018

I was actually trying to debug this issue on Google Pixel. Seems like something is wrong with the api's.
So the issue is that while trying to upload an image from google photos app, (ie. share photo). Although the MIME type received in the intent is jpeg for which we send jpg to our backend, we get an error response <?xml version="1.0" encoding="UTF-8"?> <api servedby="deployment-mediawiki-09"> <error code="verification-error" info="File extension &quot;.jpg&quot; does not match the detected MIME type of the file (image/png)."> <details> <detail>filetype-mime-mismatch</detail> <detail>jpg</detail> <detail>image/png</detail> </details> <docref xml:space="preserve">See https://commons.wikimedia.beta.wmflabs.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &amp;lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&amp;gt; for notice of API deprecations and breaking changes.</docref> </error> </api>

which states that it was expecting png while we sent the file as jpeg. I tried hard coding the image extension to png and the upload succeeded [Shocking]. I could add an exception where in I could check if the photos are uploaded from google photos make them png by default. Does not seems right but would fix the upload fail cases from google photos. Also, from the code i can conclude that this should be happening since quite a while as say the comments as well, TODOing to add fix for uploads via Google Photos,. @misaochan @neslihanturan What do you guys suggest ?

@ashishkumar468
Copy link
Collaborator

Actually not a backend bug, Although in the image info, Google Photo shows that the image is png but while sharing it, in the intent it shows that the image is jpeg and hence our backend rejects that because of which the upload fails

@neslihanturan
Copy link
Collaborator Author

@ashishkumar468 thanks for digging it! I think you are very close since we recently implemented some changes about file extensions. We convert some extensions to .jpeg or .jpg (I am not really sure but can check).

@ashishkumar468
Copy link
Collaborator

@neslihanturan Yes, we convert jpeg to jpg but that is not causing any trouble. The issue is that google photos app is giving the mime type for png images as jpeg which is causing the api to fail.

@Yannf
Copy link

Yannf commented Oct 8, 2018 via email

@ashishkumar468
Copy link
Collaborator

@Yannf Yes and that is what is causing the api's to fail at least in my case. AFAIK, upload does not fail always, right ?

@Yannf
Copy link

Yannf commented Oct 8, 2018 via email

@ashishkumar468
Copy link
Collaborator

@Yannf and the uploads are failing in that as well ?. It would be great if you could attach the logs ?

@misaochan
Copy link
Member

misaochan commented Oct 9, 2018

@ashishkumar468 Interesting, I had no idea that .png photos were so common, I was under the impression that most phone cameras take photos in .jpg! Indeed that is our failing, as we needed to quickly patch an urgent overwrite bug in production, therefore the upload service was simply made to expect a .jpg. You can see more information about that here - #228 (comment) and here - #1838 . We had intended to fix this when we implemented multiple uploads, but it seems that was a mistake.

As I mentioned to @neslihanturan on that issue:

I think what I will do is merge your PR, but keep this issue open. While the PR works as a band-aid, we still need to find out why mimeType returns null when uploaded via Share, but not via the in-app gallery button.

So if that is indeed the cause of this bug, then I guess the solution should be to formulate a proper solution for #228 that appropriately detects mimeType. Once the .jpg hack is removed, this should be solved.

The TODOs to add fix for Google Photos are actually a different issue entirely - that was the issue of people experiencing crashes when uploading from Google Photos due to not having permission to read from that Uri. That has already been fixed I believe.

@Yannf Would it be possible for you to check what extension your queued/failed photos have? Also, it is important to note that if the file extension was the issue, the failure/queued image should only happen if you upload via Share. It should not happen if you upload via the in-app Gallery button. So it would be great to see if you get different results by using the in-app Gallery button, then we can be sure that the #228 fix is the cause of the problem. :)

@ashishkumar468
Copy link
Collaborator

@misaochan The main job would be to validate the file extension somehow locally. As I have mentioned earlier, even if the extensions are png google photos are giving the MIME type as jpeg. We will have to figure out a way to validate file extensions. Apart from this indefinite progress in notification failed uploads, happening on my device due to the same reason and also faced by Jim as well would be resolved if we are able to add a patch for this.

@misaochan
Copy link
Member

Yes, we certainly need to check the file extension locally. I would be surprised if the error lies in the Google Photos API though, as I haven't been able to find any reports of that. I would have thought that it is our app erroneously assigning the MIME type as .jpeg, due to the hack I mentioned above.

ashishkumar468 added a commit to ashishkumar468/apps-android-commons that referenced this issue Oct 9, 2018
* Added a java library to fetch the MIME type from input stream
* Fetch MIME type using this and use the contribution tag only when this fails:
@ashishkumar468
Copy link
Collaborator

@misaochan @neslihanturan I have added a fix for MIME type detection, although could not find a logical bug in the method which actually attaches the extension. Although the flow needs to be refactored a bit which we can take later on. Seems like this will add a fix for the image extension issue. Raising a PR for the same

@ashishkumar468
Copy link
Collaborator

Had a basic question although , do the releases not go through master branch, as I could conclude from the thread that the issue went through the branch 2.8-release. If so, which branch am I supposed to make the PR to ? I had solved the issue on a branch cut from 2.8-release. Do I need to do it from master. It would be great if some one could clarify the same

@misaochan
Copy link
Member

@ashishkumar468 The procedure for branching and releases is detailed here: https://github.com/commons-app/apps-android-commons/wiki/Project-maintenance . It is probably a good idea to read that entire page of our wiki actually, as part of your onboarding to our team. ;)

So, the answer to your question is: It depends on whether we should release a hotfix (i.e. v2.8.5) for your fix (in which case it should go to 2.8-release) or whether we should just include it in v2.9 (in which case it should go to master). I think keeping it in 2.8-release is a good idea since your fix was so quick, so if it works then I can release it to v2.8.5 without having to wait for the other items needed for v2.9 (see #1830 ). We can cherry-pick it to master afterwards.

An additional hint: We usually use Google Hangouts for day-to-day team communication that isn't particularly useful to record in the issue itself like "Which branch should I submit this to?" (in contrast, it is correct to discuss the workflow for the fix here on GitHub, as you did). I have sent an invitation to you a couple of days ago. :)

misaochan pushed a commit that referenced this issue Oct 11, 2018
* Bug Fix #1878
* Added a java library to fetch the MIME type from input stream
* Fetch MIME type using this and use the contribution tag only when this fails:

* formatting changes, removed unused commented out line
maskaravivek pushed a commit to maskaravivek/apps-android-commons that referenced this issue Oct 13, 2018
* Bug Fix commons-app#1878
* Added a java library to fetch the MIME type from input stream
* Fetch MIME type using this and use the contribution tag only when this fails:

* formatting changes, removed unused commented out line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants