Open Bug 1921000 Opened 2 years ago Updated 2 months ago

hiplok.com - Picture stuck loading when clicked on the first page load

Categories

(Web Compatibility :: Site Reports, defect, P2)

Firefox 130
Desktop
Windows 11

Tracking

(Webcompat Priority:P3, Webcompat Score:4, firefox130 affected, firefox132 affected)

Webcompat Priority P3
Webcompat Score 4
Tracking Status
firefox130 --- affected
firefox132 --- affected

People

(Reporter: ctanase, Unassigned)

References

()

Details

(Keywords: webcompat:needs-contact, webcompat:site-report, Whiteboard: [webcompat-source:product][autowebcompat:processed][autowebcompat:repro-failed])

User Story

platform:windows,mac,linux,android
impact:feature-broken
configuration:general
affects:all
branch:release
user-impact-score:60
autowebcompat-repro-status:failed
autowebcompat-repro-reason:not_reproducible
autowebcompat-repro-report-os:all

Attachments

(6 files, 1 obsolete file)

Attached image image.png —

Environment:
Operating system: Windows 11/10
Firefox version: Firefox 130.0 (release)/132

Preconditions:

  • Clean profile

Steps to reproduce:

  1. Navigate to: https://hiplok.com/product/hiplok-dx1000/
  2. Click on the image.
  3. Observe the behavior.

Expected Behavior:
The picture is displayed.

Actual Behavior:
The picture is stuck loading.

Notes:

  • Reproducible on the latest Firefox Release and Nightly
  • Reproducible regardless of the ETP setting
  • Works as expected using Chrome

Created from webcompat-user-report:233acbd4-e432-4585-adad-3c2d7d65776a

This seems to be intermittent. Disabling the cache seems to make this work all the time, maybe? Let's try running mozregression in reverse to find if this is something we're shipping, or something that's Nightly-only.

Severity: -- → S2
User Story: (updated)
Priority: -- → P2

I can reproduce (using Firefox Nightly on Ubuntu 24.10). I tried this twice in fresh profiles and it was broken both times for me.

(I confirmed that I then got expected-results after reloading the site with devtools open. I'm not sure if that's related to the cache being disabled or not; I unticked the 'disable cache' button and yet still got expected-results with devtools open.)

Here's a performance profile of the issue, in case that ends up being useful here:
https://share.firefox.dev/40EcdjX

This is somewhat intermittent as noted in comment 1, but I reproduced in fairly old builds, e.g.:
Nightly 104.0a1 (2022-07-15)
Nightly 79.0a1 (2020-06-01)

So further mozregression testing isn't likely to be useful.

There are several related issues with this site:
(1) Sometimes the preview image area for the product is simply blank. (maybe 10-20% of the time for me) This happens in Chrome, too, and I think it's a different thing from the main bug here (particularly given that it also happens in Chrome). This prevents you from proceeding with the STR, though. If this happens to me when I'm testing, I work around it by reloading or right-clicking my tab-title and choosing "Duplicate Tab" to try again in a new tab.

(2) Sometimes when hitting this bug, the "lightbox" image does load just fine, but I can still trigger a throbber by simply pressing my leftarrow key to go to the previous image in the carousel. (In other words: sometimes the main image loads just fine, but other images in the carousel are still broken and forever-a-throbber.) This seems to be Firefox-specific -- I've never triggered this in Chrome yet -- and I think it's a generalized version of this bug.

Looking at profiles (and in network devtools when that doesn't prevent the bug from reproducing), I think this might be some weirdness on the server where it's sending an image with the wrong MIME type, and we're failing to decode it properly as a result of that, or something along those lines... Or maybe just a wholly corrupt image, some of the time?

Dropping a few notes...

Here's a profile I just captured of this bug: https://share.firefox.dev/3O4RRZx

The relevant DOM that's permanently-a-throbber here is:

<div class="fslightbox-absoluted fslightbox-full-dimension fslightbox-flex-centered" style="transform: translateX(0px);">
  <div class="fslightbox-loader"><div></div><div></div><div></div><div></div></div>
  <div class="fslightbox-fade-in">
    <img class="fslightbox-source " src="https://hiplok.com/wp-content/uploads/2023/11/image-1.png">
  </div>
</div>

fslightbox-loader is the throbber-image, and image-1.png is the image that's supposed to load and replace it, but it seems the image never loads (and indeed, if I hover over the URL in devtools inspector, the tooltip says "Could not load the image").

Filtering the network tracks for this image-1.png URL (as in the share.firefox.dev short-link above), I see 3 requests in rapid succession - the first two from XHRs and "MIME type: image/png", and the last one from a regular image request and has "MIME type: image/webp".

That change (different MIME type the same URL) seems definitely odd.

Moreover, if I issue similar requests myself just using curl, I get different results from time to time, sometimes giving me corrupt images with no content-type in the output at all... [EDIT: this was from me messing up my terminal commands a bit; it looks like curl gets me consistent results after all.]

Here's a screenshot of network devtools showing some clues, after this happened for the aforementioned image-1.png.

Notable clues about what might be going wrong here:

  • We issued the request for only a partial range of the image (note content-range: bytes 179109-602371/602372 in the response-headers on the right, and http status 206 ("partial content") as the response-status; and in the request-headers if I scroll down, it shows Range: bytes=179109- and If-Range "e64bb-615402d8ed15d".)
  • We judged the response to have resulted in CORRUPTED_CONTENT (per the "Transferred" column on the left pane), and to have had size 0 (not sure if that means we really got a zero-sized payload, or if we got some payload and rejected it as invalid).
  • There were previous requests for the same image -- albeit with a different filetype (from a different "Accept" header being used) -- which were aborted. I can see that those got partial responses (I think) by hovering them and seeing the partially-painted image-data that came back.

I don't know why those earlier image requests were aborted, but they seem to have been issued by JS. I'm guessing the JS is just trying to prime the cache on the server to get things ready for the actual image request, and doesn't actually care about the response.

So, here's a theory: maybe those JS-initiated XHR requests are resulting in some partial data being cached by us; and then when we go back to initiate the "real" network request for the image, we do so as a partial-request to resume from where the earlier requests were aborted; and that ends up resulting in corrupt image-data because the two requests are issued with different Accept headers and hence result in different image-formats being returned? (despite the ".png" filename)

In any case, this seems like something going awry in networking/cache code (possibly imagelib, but probably networking). --> hoping the networking folks can finish diagnosing this.

User Story: (updated)

In case it's useful to capture, here's a screencast showing:

  • the painted partial image data (shown on hover) from the two XHR-initiated requests, vs. no paintable data for the img-initiated request.
  • The different "Accept" request-headers for the img-initiated request vs. the XHR-initiated ones.
  • The different "content-type" response headers (PNG vs WebP) for the img-initiated request vs. the XHR-initiated ones. (Also "content-length" varies, maybe/probably others too.)

For completeness... Here's the PNG file that I get if I right-click the XHR line and choose "copy value | copy as curl" and then execute that result and save it to a file.

...and here's the WEBP file that results from me doing the same copy-as-curl dance for the img-initiated request that DevTools shows as NS_ERROR_CORRUPTED_CONTENT. Note, before I executed this, I removed the "Range" and "If-Range" headers, so that I'd be requesting the full file. (I think the presence of those headers is what's causing trouble in our request from Firefox.)

I just noticed some more evidence for my theory at the end of comment 5 (with the tl;dr of that theory being: we're requesting the tail-end of a WebP file to resume from an earlier interrupted PNG file, and slapping those two pieces together results in a corrupt franken-file). In my screenshot in comment 5 and screencast in comment 6...

  • the most that we received was 179.11 KB in our earlier aborted XHR-initiated requests for PNG-flavored image1.png (see the top entry in the "Size" column)
  • ...and that happens to be exactly the starting point that we request the partial-range to start from in the final WebP-flavored request -- my screencast in comment 6 shows that our request headers had Range: 179109- which (in bytes) is 179.11 KB.
  • So: why are we requesting a range starting at 179109 bytes? Because we think we've already got that much data cached locally from our earlier request. But in fact that data was cached for a different file-type and is not usable for this new request (which we're issuing with a different Accept header from the earlier request -- in particular, our new one explicitly includes image/webp in the Accept header, and the presence of that string anywhere in that header seems to be necessary-and-sufficient to get a WebP result here).

I think this bug has a lot to do with the If-Range <etag> header that we're sending... Note comment 5 mentions that we send our final request with If-Range "e64bb-615402d8ed15d" which I think means "if this resource is the same one that you provided earlier with an etag header of e64bb-615402d8ed15d, then please honor the range request; otherwise send the file as-a-whole". And in this case, the site is always sending the resource (whether it's the PNG or its WEBP version) with that same etag as you can see in the screencast in comment 7 if you look carefully at the response headers for the different requests.

I think this is a server-side bug -- it's probably not valid for them to be sending the same etag here for two different resources at the same URL.

The RFC that defines etag has a section on Entity Tags Varying on Content-Negotiated Resources-- that's the situation we're in here -- the resource's content is negotiated based, in this case based on the Accept header. (The example in this spec-section uses a different header -- Accept-Encoding -- but it references section 12 which lists other similar headers including Accept). And this section of the spec says that the etag should be different for this case, with this additional note:

Note: Content codings are a property of the representation data, so a strong entity tag for a content-encoded representation has to be distinct from the entity tag of an unencoded representation to prevent potential conflicts during cache updates and range requests. In contrast, transfer codings (Section 7 of [HTTP/1.1]) apply only during message transfer and do not result in distinct entity tags.

I think the WebP vs PNG representation here is pretty-clearly more in the "content coding" bucket than the "transfer coding" bucket, so it seems like a distinct etag would be required...

Here's a profile of the bug with HTTP logging enabled:
https://share.firefox.dev/3YPUKm1

In this case the image that failed to load was the first one that's shown in the lightbox view, which is
https://hiplok.com/wp-content/uploads/2023/11/DXM1AB-Studio-SS-ART.jpg

Network DevTools show it suffering the same fate as in my comment 5 screenshot (except with JPG instead of PNG for this particular image). Specifically: there are are two initial XHR-initiated requests which get a JPEG-filetype response, and then there's 3rd img-initiated request with a range header, which gets back WebP data with status: 206 (accepting the range request) which we judge to result in CORRUPTED_CONTENT. In this case, the etag for all three requests is "1f917-615402d8e92dc".

(I was curious to check how/why this works in Chrome -- e.g. whether they're getting the same XHRs, whether they're sending a similar range-request for the final image load -- but I've now gotten into a state where Chrome is failing to load even the first rendering of the page, no matter how many times I try -- i.e. Chrome is hitting the issue mentioned in comment 3 section (1) here. So: I'm blocked from getting far enough on the site to see how/why it was working there. Having said that, perhaps this is a sign that general brokenness on this site isn't really a Firefox-specific experience...)

Attachment #9437039 - Attachment description: WEBP file resulting from the XHR request for image1.png with 'Accept:: image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5" → WEBP file resulting from the `img`-initiated request for image1.png with 'Accept:: image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"

[Sorry, comment 14 was from me misunderstanding how Chrome attributes the img request in its network log -- Chrome shows that partiuclar request as being initiated from autoptimize_9c3e3f983827606f44a51d412603c048.js, but it's actually initiated by the piece of that script that generates the img element.]

Looking at Chrome's network requests, I'm seeing a request from the XHR that receives a PNG result, and I'm seeing a request from the img that receives a webp result (just as in Firefox). I think the key difference is that Chrome isn't bothering to include a Range header in their img request (so they get an atomic self-contained full response back for the resulting WebP file).

Attachment #9438208 - Attachment description: screencast showing headers/response for the XHR network-request in Chrome (notably including `Accept:...image/webp...` instead of `*/*`) → (Chrome screencast that I misinterpreted; ignore)
Attachment #9438208 - Attachment is obsolete: true

Here's a screencast showing the network requests in Chrome.

As compared to the ones in Firefox in comment 7, the relevant difference that I'm seeing is that Chrome doesn't use the "Range" or "If-Range" headers in its 3rd img-initiated request (the one that elicits a webp-filetype result from the server).

Not sure if that's due to them just failing to notice that there was an earlier potentially-resumable request (the thing that we're presumably noticing here), vs. if they're applying some sort of heuristic to decide that resuming would be unwise here, e.g. due to the different Accept header-value.

It sounds like Daniel has gotten to the root of this here - we're asking for a range w/ etag, Chrome isn't, and the site is returning something very wrong (different data with the same etag - comment 11 and comment 12).

Given this, I'm not sure what else we can do. Maybe we could disable range requests, but we really don't want to disable them globally. We could special-case this site and disable them, that seems problematic unless that's something we could do in a site intervention (I doubt it without landing new abilities to provide to the intervention code somehow).

Maybe we could contact the site. Not sure they'd have the knowledge to do something about it, but if they tell us what server and some info on how it's configured, maybe we can talk to the upstream server people

User Story: (updated)

It looks like the images are being served by cloudflare so it probably makes more sense to bring it up with cloudflare than with hiplok. Can we construct a reduced test case that shows the problem?

Webcompat Priority: --- → P3
Webcompat Score: --- → 4
User Story: (updated)
Whiteboard: [webcompat-source:product] → [webcompat-source:product][autowebcompat:processed]
User Story: (updated)
Whiteboard: [webcompat-source:product][autowebcompat:processed] → [webcompat-source:product][autowebcompat:processed][autowebcompat:repro-failed]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: