net::ERR_<unknown> when using Chrome, Range Request and no Cache Hinting

124 views
Skip to first unread message

Donald Gordon

unread,
Apr 7, 2016, 12:48:46 PM4/7/16
to PDFTron WebViewer
Hi

I've configured my webviewer to turn off cache hinting with the following configuration file:

ReaderControl.prototype.loadDocument = function(doc, options) {
      var cacheHinting = window.CoreControls.PartRetrievers.CacheHinting;
      var partRetriever = new window.CoreControls.PartRetrievers.HttpPartRetriever(doc, cacheHinting.NO_HINT, options.decrypt, options.decryptOptions);
this.docViewer.loadAsync(partRetriever);
};

When I do this, on a server that supports partial content requests (e.g. webfsd), I get the following error message indicating that a part of the ZIP could not be downloaded, in this case a page thumbnail: http://imgur.com/NtZ74JD

To reproduce this, take the WebViewer.zip file from the PDFTron site.  Modify WebViewer/doc/WebViewer_User_Guide.html and add the line 'config:"config.js",' on or around line 39.  Add a file "config.js" with the contents as above, to the same folder as the html file.  Serve the files off an HTTP server with range request support (I use webfsd for testing).  Load the file in Chrome 49 or 47. Reload the page a few times -- in my tests, the error would appear within 5 reloads, but not every time.


While for this document, the error message does not stop the document loading, for other documents I have converted, it does, usually Annots.xfdf -- and that means no document ever appears in the webviewer.

If I turn the cache hinting feature off, then I can't serve my Xod files from CloudFront with Signed URLs and byte-range requests.  Cloudfront will deny requests if extra query parameters are added to the signed request.

Other browsers (Firefox, MSIE) don't seem to have this problem.  CloudFront delivers a noticeable performance improvement over serving my documents from S3, so I'm loathe to remove it from my setup.

Can you please look at this?

Regards

Donald


Matt Parizeau

unread,
Apr 8, 2016, 4:27:40 PM4/8/16
to PDFTron WebViewer
Hi Donald,

We were able to reproduce the issue and it seems to consistently happen on every other refresh. Interestingly we tried testing in Chrome Canary and were not able to reproduce the problem so it seems to already be fixed. Unfortunately this means that this is a Chrome bug and we'll have to wait until the newer Chrome version with the fix is widely available.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Donald Gordon

unread,
Apr 11, 2016, 12:59:37 PM4/11/16
to PDFTron WebViewer
Hi

Would it be possible to get the HTTPPartRetriever to retry requests that fail in this manner?  Unfortunately as this part of the code is minified it's a bit tricky to try this out myself.

Regards

Donald

Matt Parizeau

unread,
Apr 11, 2016, 2:00:18 PM4/11/16
to PDFTron WebViewer
Hi Donald,

I made an experimental build that will retry the request and it seems like it might be working. In my tests I never had any failures on something critical like Annots.xfdf, but thumbnails and pages seem to be loading. Hopefully it covers your case as well: http://www.pdftron.com/ID-zJWLuhTffd3c/WebViewer/WebViewer_2.1.0.42822-request-retry.zip

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Donald Gordon

unread,
May 31, 2016, 7:06:40 PM5/31/16
to PDFTron WebViewer
That worked.  Did this patch make it into the WebViewer 2.2 build?

Regards

Donald

Kristian Hein

unread,
Jun 1, 2016, 1:40:55 PM6/1/16
to PDFTron WebViewer
Hello Donald,

This change did not make into the build, as it was deemed too experimental. Now that you have confirmed that the changes worked, we will include it in the next version.

Donald Gordon

unread,
Jun 2, 2016, 1:06:01 PM6/2/16
to PDFTron WebViewer
Thanks Kristian.  Could you do me a custom build of 2.2 with this change added?

Regards

Donald

Matt Parizeau

unread,
Jun 8, 2016, 6:48:43 PM6/8/16
to PDFTron WebViewer
Hi Donald,


Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages