Skip to content

Fix handling of fetch errors #13937

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

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

das7pad
Copy link
Contributor

@das7pad das7pad commented Aug 26, 2021

Hi!

We at @overleaf noticed that the error handling of network downloads is incomplete in a few scenarios.

We are hosting a lot of user content on a large cluster of VMs that scales with load. As VMs go, users will see 404s for downloads that reference PDFs on an old VM. Our user base is very diverse and so are the networks they access this content from, leading to occasional increases of network errors that are out of our control.

When downloads fail, our frontend got stuck in waiting for PDF.js to render or cleanup an instance -- despite already seeing network errors from the OS/browser in the Developer Tools.
These errors would turn up in the console as unhandled promise rejections and never reached our frontend code.

This PR is making sure that network errors make it to the call-sites.

Testing:

  • delete the pdf file while the initial request is inflight
  • delete the pdf file after the initial request has finished

Repeat for a small file and large file, exercising both one-off and chunked transports.

We are seeing good results with the patch (rebased on top of v2.2.288) in production over the course of the past 2 months.

I ran the test suite as per the docs and it passed -- apart from a few pixel imperfections that seem to be unrelated to the patch, see example below.

image

Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me aside from this comment, but I'd like @Snuffleupagus to also have a look here since I'm not overly familiar with this code.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me, thank you!

r=me, with the comment addressed.

@Snuffleupagus Snuffleupagus changed the title [misc] fix handling of fetch errors Fix handling of fetch errors Aug 30, 2021
Testing:
- delete the pdf file while the initial request is inflight
- delete the pdf file after the initial request has finished

Repeat for a small file and large file, exercising both one-off and
 chunked transports.
@das7pad das7pad force-pushed the jpa-fix-error-handling branch from 6687f2c to 291ffd3 Compare August 30, 2021 11:44
@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://3.101.106.178:8877/b23abab2edae538/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/9828a06074c6f96/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/9828a06074c6f96/output.txt

Total script time: 33.72 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 5

Image differences available at: http://54.67.70.0:8877/9828a06074c6f96/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/b23abab2edae538/output.txt

Total script time: 40.22 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 11
  different first/second rendering: 2

Image differences available at: http://3.101.106.178:8877/b23abab2edae538/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/a792de60ea3b953/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://3.101.106.178:8877/8f66734e01a01a6/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/a792de60ea3b953/output.txt

Total script time: 4.60 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/8f66734e01a01a6/output.txt

Total script time: 6.17 mins

  • Integration Tests: Passed

@Snuffleupagus Snuffleupagus merged commit cf0ccc4 into mozilla:master Aug 30, 2021
@das7pad
Copy link
Contributor Author

das7pad commented Aug 30, 2021

Thank you for the review feedback @Snuffleupagus ! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants