WebPlatformForEmbedded / WPEWebKit

WPE WebKit port (downstream)
214 stars 139 forks source link

[wpe-2.38] Randomly wrong image is displayed as div background #1186

Closed jakub-gocol-red closed 10 months ago

jakub-gocol-red commented 1 year ago

Reproduction steps

  1. Open Solitaire app
  2. Click "Click here" button (menu that allows to enter player name will pop up)
  3. Verify keyboard background

Expected result

Everything is rendered correctly

Actual result

Wrong background image is rendered. Web inspector shows correct css property, server always returns correct image. Browser rendered incorrect image.

Notes

This issue happens randomly on Solitaire and Space moodies, with different images. Reproduction described above is most common. But if you play those games for some time, you'll notice there are more glitches like that.

Few examples of correct and incorrect rendering: cardborder keyboardbackground spacemoodies

It reproduces only on wpe2.38 on devices with broadcom chip. I reproduced it for example on Sagemcom Video Accelerator (Sagecom m393 with Broadcom 72180 chip). It doesn't reproduce on google chrome, epiphany, x86 MiniBrowser, wpe2.22 and 2.38 on devices with amlogic and realtek chips.

When I remove implementation of MemoryCache::pruneLiveResourcesToSize function, issue stops reproducing. There is some correlation with MemoryCache mechanism. Issue reproduces only for images that were removed then readded to cache. Never for images that were never deleted.

magomez commented 1 year ago

@jakub-gocol-red I've just pushed a couple of commits to wpe-2.38 that may have fixed this. Could you pull these and test whether the problem is still reproducible? Thanks in advance!

magomez commented 1 year ago

Ah, forget it, I thought this was a problem with the accelerated canvas but it's not. Forget my comment. Sorry for the noise!

magomez commented 11 months ago

@jakub-gocol-red I've been giving this a try and I'm not able to reproduce it anymore. I guess this was fixed by https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1233 or https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1209. Could you try whether this still reproduces on your side? Please close this if it's fixed. Thanks!

jakub-gocol-red commented 11 months ago

@magomez I still can reproduce it quite easily, even with those patches.

magomez commented 11 months ago

I've finally been able to reproduce this. It happens when the RAM size (real or fake) is smaller than 512MB. In this case, the memory cache only has 8MB to store resources, which doesn't seem enough to keep all the resources of those pages. This leads to some resources being pruned from the cache, and it seems that there's some error doing so that causes the glitches. I checked that this reproduces on 2.42 as well, so maybe its something that happens upstream but hasn't been discovered yet. I'll dig into the code to try to find the problem.

rychem commented 11 months ago

@magomez thanks for info. If you had any draft PR would you please share for us to verify on our platforms/settings?

magomez commented 11 months ago

I've already found the problem. I've created https://bugs.webkit.org/show_bug.cgi?id=265990 and proposed a fix for it that's waiting for review. As soon as it's approved I'll port it to 2.38 and 2.42.

magomez commented 10 months ago

I've just pushed ee006a258bb754ca841b429c886c701ad1a5fe4f to the wpe-2.38 branch that should fix this issue. I've checked that it's no longer reproducible on my side. @jakub-gocol-red could you verify the fix on your side and close this is it's fixed? Thanks!

jakub-gocol-red commented 10 months ago

It fixes the issue for me. Thanks a lot