sugarlabs / browse-activity

Sugar activity to browse the internet; WebKit on GTK on Sugar Toolkit
GNU General Public License v2.0
9 stars 44 forks source link

Sometimes fails to download and show PDF #106

Open quozl opened 5 years ago

quozl commented 5 years ago
1568155200.231043 ERROR root: FINISHED file:///home/guest/Downloads/Carolyn_FINAL_DRAFT_OWL_1_.pdf
Traceback (most recent call last):
  File "/usr/share/sugar/activities/Browse.activity/pdfviewer.py", line 555, in __download_finished_cb
    self._show_pdf()
  File "/usr/share/sugar/activities/Browse.activity/pdfviewer.py", line 482, in _show_pdf
    self._evince_viewer = EvinceViewer(self._pdf_uri)
  File "/usr/share/sugar/activities/Browse.activity/pdfviewer.py", line 66, in __init__
    self._doc = EvinceDocument.Document.factory_get_document(uri)
gi.repository.GLib.Error: g-io-error-quark: Error opening file /home/guest/Downloads/Carolyn_FINAL_DRAFT_OWL_1_.pdf: No such file or directory (1)
1568155200.236871 ERROR root: FINISHED file:///home/guest/Downloads/Carolyn_FINAL_DRAFT_OWL_1_.pdf

URL was https://wiki.sugarlabs.org/go/File:Carolyn_FINAL_DRAFT_OWL_1_.pdf which contains link to a PDF https://wiki.sugarlabs.org/images/b/b0/Carolyn_FINAL_DRAFT_OWL_1_.pdf

chimosky commented 4 years ago

This is difficult to reproduce, I've tried and the document opens.

quozl commented 4 years ago

Thanks for testing. Yes, it only happens sometimes, so it may be a race condition that depends on network latency or other operations on the same computer.

I've tested again. In 32 attempts on a single core QEMU VM, the traceback happened once. It also happened once in 36 attempts on an eight core QEMU VM on an eight core system.

Traceback (most recent call last):
  File "/usr/src/sugar-activities/Browse.activity/pdfviewer.py", line 555, in __download_finished_cb
    self._show_pdf()
  File "/usr/src/sugar-activities/Browse.activity/pdfviewer.py", line 482, in _show_pdf
    self._evince_viewer = EvinceViewer(self._pdf_uri)
  File "/usr/src/sugar-activities/Browse.activity/pdfviewer.py", line 66, in __init__
    self._doc = EvinceDocument.Document.factory_get_document(uri)
gi.repository.GLib.Error: g-io-error-quark: Error opening file /home/guest/Carolyn_FINAL_DRAFT_OWL_1_.pdf: No such file or directory (1)

I've proved that the XDG directories don't need to exist for this traceback to occur. In the first traceback in the opening comment, the Downloads directory is referenced. In this second traceback, it is not. The Downloads directory can be created by running the xdg-user-dirs-update command in Terminal.

We don't need to reproduce in order to find and fix a problem, but it would sure help.

Saumya-Mishra9129 commented 4 years ago

I am able to reproduce it in alternate attempts. It is somewhat similiar error as in toolkit - https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/441