Skip to content
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

[Problem/Bug]: Cache constantly growing even when not browsing. #4410

Closed
Comawhite54 opened this issue Mar 6, 2024 · 3 comments
Closed

[Problem/Bug]: Cache constantly growing even when not browsing. #4410

Comawhite54 opened this issue Mar 6, 2024 · 3 comments
Assignees

Comments

@Comawhite54
Copy link

Comawhite54 commented Mar 6, 2024

What happened?

I am using webView2 to display an HMI.
This HMI is basically just displaying status from some "OPC xml" requests.

The problem is that, something in this HMI is making my cache folder constantly growing as soon as the page is active.

  • I have not enough knowledge to know exactly what causes this, or how to prevent this (maybe I can limit the cache size but I guess a better option can be found).
  • I still need the caching to be active as it helps a lot to open pages faster.
  • The file which is growing is : "..\UserData\EBWebView\Default\Cache\Cache_Data\data_1".

1- Is is possible to prevent certain files from being cached?
2- The only "relevant" thing that I can see so far in the debug console (tab network) is "http://192.*****/authinfo.xmlf?r=0.8826645356481213"
I assume this type of request is storing a new xml file in the cache every time, does this sounds plausible ?
If so, is there any way to prevent the client to cache such type of files with unique ID after it's extension?
3- Is there any advanced configuration for the cache, or options to clean only some of the cached files, by extension for example, instead of the whole cache?

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

1.0.2365.46

Framework

Win32

Operating System

Windows 10

OS Version

19045.4046

Repro steps

To reproduce, one needs to access my host by remote I think.

Repros in Edge Browser

Yes, issue can be reproduced in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

@Comawhite54 Comawhite54 added the bug Something isn't working label Mar 6, 2024
@LiangTheDev
Copy link
Member

It sounds like related to http cache. If you look at the related http response headers, you might be able to figure out what is cached unnecessarily. If you have control over the related server, you could change the header it sends out to avoid unnecessary cache.

At WebView2 level, there is ClearBrowsingData API to clear specific kind of caches including COREWEBVIEW2_BROWSING_DATA_KINDS_DISK_CACHE. However, that would clear all caches and impact page load.

There is a Chromium command line switch --disk-cache-size that could specify desired disk cache limit in bytes. You could try it out. Note that it is a soft limit that the code makes best effort to maintain, not a hard limit. But it should prevent the cache from keep growing forever.

@victorhuangwq
Copy link
Collaborator

Closing issue as it has been resolved

@LiangTheDev LiangTheDev removed the bug Something isn't working label Mar 7, 2024
@Comawhite54
Copy link
Author

I didn't realize it was solved. Thank you...

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

No branches or pull requests

3 participants