Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

resize_rendered_image_dimensions example behaves odd #1352

Open
oschaaf opened this issue Jul 16, 2016 · 5 comments
Open

resize_rendered_image_dimensions example behaves odd #1352

oschaaf opened this issue Jul 16, 2016 · 5 comments

Comments

@oschaaf
Copy link
Member

oschaaf commented Jul 16, 2016

resize_rendered_image_dimensions unexpectedly starts serving the unoptimized version of the image linked in the html at modpagespeed.com [1]. I can reproduce it with a couple of page refreshes. I suspect this happens after re-beaconing.

Appending &random=rnd to the querystring of the html in a follow-up test restarts the sequence of unoptimized/optimized/unoptimized for the linked image.

[1] http://www.modpagespeed.com/resize_rendered_dimensions/image_resize_using_rendered_dimensions.html?PageSpeed=on&PageSpeedFilters=resize_rendered_image_dimensions

@oschaaf
Copy link
Member Author

oschaaf commented Jul 23, 2016

I added some VLOG's and refreshed the example page a couple of times in Chrome: image_resize_using_rendered_dimensions.html?PageSpeed=on&PageSpeedFilters=resize_rendered_image_dimensions

The following lines represent the json string passed to CriticalImagesFinder::JsonMapToRenderedImagesMap:

2016/07/23 22:51:38 [debug] 45776#45776: [ngx_pagespeed 1.11.0.0-8015] [0723/225138:VERBOSE2:critical_images_finder.cc(402)] [pagespeed] pjson: {"217456902":{"rw":150,"rh":100,"ow":256,"oh":192}}
2016/07/23 22:51:45 [debug] 45776#45776: [ngx_pagespeed 1.11.0.0-8015] [0723/225145:VERBOSE2:critical_images_finder.cc(402)] [pagespeed] pjson: {"217456902":{"rw":150,"rh":100,"ow":150,"oh":100}}
2016/07/23 22:51:53 [debug] 45776#45776: [ngx_pagespeed 1.11.0.0-8015] [0723/225153:VERBOSE2:critical_images_finder.cc(402)] [pagespeed] pjson: {"217456902":{"rw":150,"rh":100,"ow":256,"oh":192}}
2016/07/23 22:52:08 [debug] 45776#45776: [ngx_pagespeed 1.11.0.0-8015] [0723/225208:VERBOSE2:critical_images_finder.cc(402)] [pagespeed] pjson: {"217456902":{"rw":150,"rh":100,"ow":150,"oh":100}}

The original width ("ow") and height ("oh") of the image are 256X192. The JSON seems to alternate between the original size and the rendered size.
Unfortunately, the last state, the one where the original and rendered dimensions are rembered as being equal, is state that will stick.

Inspecting the beacon data that gets posted back at some point shows:

oh:snmbIULsqL
n:9wWFb6-jTnY
ci:217456902
rd:{"217456902":{"rw":150,"rh":100,"ow":150,"oh":100}}

Is the critical image beacon taking the resized image and posting back the resized dimensions as the original ones?

@petergus
Copy link

Any ideas where to start with debugging this? Could it be related to rewriting javascript?

@oschaaf
Copy link
Member Author

oschaaf commented Apr 11, 2018

@petergus
I left off with #1352 (comment)
It's a bit of a guess, but I wonder if it makes sense for the script to beacon back the resized image dimensions. Maybe if we can prevent that from happening, the problem will go away.

@petergus
Copy link

I'm just an end user at this point, so if you can give me direction to look into, what to edit, and what debug commands to check I can spend some time on testing.

@oschaaf
Copy link
Member Author

oschaaf commented Apr 17, 2018

If PrepareForBeaconInsertionHelper() [1] has determined we should beacon, the filter that drives the actual rendering of resized images should back off of making any changes, to avoid the beacon reporting the original dimensions as the resized ones. I have yet to figure out where to exactly do that.

[1]

void PrepareForBeaconInsertionHelper(CriticalKeys* proto,

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

No branches or pull requests

3 participants