fenix icon indicating copy to clipboard operation
fenix copied to clipboard

[Bug] Firefox Fenix crashes when trying to open a PDF file hosted in a GitLab repository

Open SeSodesa opened this issue 6 years ago • 13 comments

Steps to reproduce

Navigate to a GitLab project that has pushed a PDF file in it. Click on the file and wait for the page to load.

Expected behavior

The GitLab PDF viewer should display the uploaded PDF file, after Firefox has fully finished loading the page.

Actual behavior

Firefox tries to load the page, but fails. During the initial attempt, the loading process is interrupted and an about:blank page is loaded instead, after which the browser tries loading the page with the PDF for a second time. During this second load attempt, the browser crashes to the Android home screen without any error messages.

Device information

  • Android device: Nokia 8, Android 9 with the 2020-07-01 security update.
  • Fenix version: 81.1.4, build #2015768387

┆Issue is synchronized with this Jira Task

SeSodesa avatar Oct 19 '20 15:10 SeSodesa

@SeSodesa thanks for the report!

@SeSodesa could you share the link of the document? We did some improvement on nightly.If it's not much trouble would you mind trying it on nightly? :)

Amejia481 avatar Oct 19 '20 18:10 Amejia481

@SeSodesa could you share the link of the document? We did some improvement on nightly.If it's not much trouble would you mind trying it on nightly? :)

I am unable to link to the specific document, as it is in a private repository. I tried loading the page on nightly, but the same thing happened again: two load attempts, the first one fails and then the second one crashes the browser. The only thing that was maybe a little different was that the about:blank page didn't flash on screen visibly, before the second load attempt.

I should mention, that the culprit PDF size is roughly 1 MB. I don't know if GitLab does something special to prevent larger documents from loading and the failure occurs because of that, but it might be something to look into.

SeSodesa avatar Oct 20 '20 09:10 SeSodesa

Don't worry, thanks for the info. There is a way to send us the crash, you have to go to: the three dotted menu -> Settings -> About Firefox Nightly -> Crashes

Each item has a share button, you could share it to the clipboard or another app that allows you to copy it and paste it here.

Thanks in advance!

Amejia481 avatar Oct 20 '20 13:10 Amejia481

@SeSodesa we did some improvements in nightly could you verify if this is still an issue? I will ask to the QA team to help us to verify too.

Amejia481 avatar Nov 17 '20 15:11 Amejia481

The issue still persists with the ~1.3MB file. I tried it with a different, much smaller PDF file (~20kB) as well and it has no trouble loading.

The file size might be an issue, then. Both have embedded vector graphics (Matplotlib or TikZ/PGF images), so that can't be the issue.

SeSodesa avatar Nov 18 '20 08:11 SeSodesa

Also, the About Firefox Nightly > Crashes page shows a message "No crash reports have been submitted.".

SeSodesa avatar Nov 18 '20 08:11 SeSodesa

I had tested this issue on Release 81.1.4 from 10/07 and the latest Nightly 201118 GV 85 from 11/18 with Motorola Moto G6 (Android 8) and Huawei P9 Lite (Android 7) and I can reproduce it following the steps:

  1. Launch Fenix and go to https://gitlab.com/SeppPenner/PySimpleGUI/-/blob/master/YoloObjectDetection/cv_dl_resource_guide.pdf
  2. Tap on Download button;
  3. Observe the behavior.

The page becomes blank and sometimes the app is closing but is still in the Recent Apps list.

20201118_140203

This is not reproducible on Pixel 2 (Android 9). I will remove the qa:needed label for now.

ebalazs-sv avatar Nov 18 '20 12:11 ebalazs-sv

After some debugging, I noticed the error doesn't have to do with the download process, it's linked to the embedded PDF viewer. I'm able to replicate the issue using an Android 8 emulator just by loading the page and trying to scroll the page after the first page of the PDF is rendered. As it's a native crash I opened a bug for the GV team to take a look https://bugzilla.mozilla.org/show_bug.cgi?id=1687333

Amejia481 avatar Jan 18 '21 18:01 Amejia481

This is a heavy page, and some older phones cannot handle it. That's OK, there's nothing really that we can do about not crashing in this case. Chrome also crashes on this page.

@Amejia481 The only thing we should do is display an error page when the content process gets killed while it's displaying a foreground page, this matches what Chrome does, so at least we don't kill the whole browsing session.

Note that sometimes the main process gets killed instead of the content process, in that case there's no way to recover, and that's fine, Chrome also sometimes gets killed outright for the same reason.

Screenshot_2021-01-28-15-04-03

agi avatar Jan 28 '21 23:01 agi

This is a heavy page, and some older phones cannot handle it. That's OK, there's nothing really that we can do about not crashing in this case. Chrome also crashes on this page.

@Amejia481 The only thing we should do is display an error page when the content process gets killed while it's displaying a foreground page, this matches what Chrome does, so at least we don't kill the whole browsing session.

Note that sometimes the main process gets killed instead of the content process, in that case there's no way to recover, and that's fine, Chrome also sometimes gets killed outright for the same reason.

Screenshot_2021-01-28-15-04-03

Thanks for investigating! Do you have a callback on gv for detecting when that happens?

Amejia481 avatar Jan 29 '21 14:01 Amejia481

Yes GeckoSession.ContentDelegate.onKill: https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.ContentDelegate.html#onKill-org.mozilla.geckoview.GeckoSession-

agi avatar Jan 29 '21 17:01 agi

You have to check in Fenix/AC that the session that received onKill is the one being displayed, and if so, display an error page similar to Chrome above

agi avatar Jan 29 '21 17:01 agi

Thanks! I opened this issue for handling this case https://github.com/mozilla-mobile/fenix/issues/17698

Amejia481 avatar Jan 29 '21 18:01 Amejia481