Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

CefSettings.root_cache_path (5.9) #1242

Closed
KVonGit opened this issue Nov 26, 2024 · 5 comments
Closed

CefSettings.root_cache_path (5.9) #1242

KVonGit opened this issue Nov 26, 2024 · 5 comments

Comments

@KVonGit
Copy link
Collaborator

KVonGit commented Nov 26, 2024

https://discord.com/channels/1278365322054996018/1310990109797253141

Attempting to play more than one game using multiple instances of the 5.9 desktop build throws an error.

image

log message:

[1126/130544.767:WARNING:resource_util.cc(83)] Please customize CefSettings.root_cache_path for your application. Use of the default value may lead to unintended process singleton behavior.
@KVonGit
Copy link
Collaborator Author

KVonGit commented Nov 26, 2024

https://github.com/cefsharp/CefSharp/blob/9647d96423e0278bbf8f4b3ad805ef0f58b4b032/CefSharp.Example/CefExample.cs#L75-L81

            //The location where cache data will be stored on disk. If empty an in-memory cache will be used for some features and a temporary disk cache for others.
            //HTML5 databases such as localStorage will only persist across sessions if a cache path is specified. 
            settings.RootCachePath = Path.GetFullPath("cache");
            //If non-null then CachePath must be equal to or a child of RootCachePath
            //We're using a sub folder.
            //
            settings.CachePath = Path.GetFullPath("cache\\global");

@KVonGit
Copy link
Collaborator Author

KVonGit commented Nov 26, 2024

I don't know enough about this to even attempt theorizing a possible fix.

Even if I knew where to set the proper value, I wouldn't know what the proper value was.

I don't see it being set in any editable file in the build directory:

kv@DESKTOP-FOOBAR2:/mnt/c/Users/kv/Documents/GitHub/quest/Quest/bin/x86/Debug$ grep -InHr "RootCachePath" *
CefSharp.Core.Runtime.xml:587:of RootCachePath. If this value is empty then browsers will be created in "incognito mode"
CefSharp.Core.Runtime.xml:589:(installation-specific data will still be persisted in RootCachePath). HTML5 databases
CefSharp.Core.Runtime.xml:672:an absolute path that is must be either equal to or a child directory of CefSettings.RootCachePath (if RootCachePath is
CefSharp.Core.Runtime.xml:2039:child directory of CefSettings.RootCachePath.If this value is empty then browsers will be
CefSharp.Core.Runtime.xml:2041:specific data is persisted to disk(installation - specific data will still be persisted in RootCachePath).
CefSharp.Core.Runtime.xml:13525:        <!-- Discarding badly formed XML document comment for member 'P:CefSharp.Core.CefSettingsBase.RootCachePath'. -->
CefSharp.Core.xml:699:            of <see cref="P:CefSharp.CefSettingsBase.RootCachePath"/>. If this value is empty then browsers will be created in "incognito mode"
CefSharp.Core.xml:701:            (installation-specific data will still be persisted in <see cref="P:CefSharp.CefSettingsBase.RootCachePath"/>). HTML5 databases
CefSharp.Core.xml:708:        <!-- Badly formed XML comment ignored for member "P:CefSharp.CefSettingsBase.RootCachePat
" -->
CefSharp.Core.xml:35254:            either equal to or a child directory of CefSettings.RootCachePath.
CefSharp.Core.xml:35337:            child directory of <see cref="P:CefSharp.CefSettingsBase.RootCachePath"/>.
CefSharp.Core.xml:35340:            (installation - specific data will still be persisted in <see cref="P:CefSharp.CefSettingsBase.RootCachePath"/>).
CefSharp.xml:5659:             running app is relaunched with the same CefSettings.RootCachePath value.
CefSharp.xml:5663:             a given CefSettings.RootCachePath value. On relaunch the app checks a
CefSharp.xml:7320:             running app is relaunched with the same CefSettings.RootCachePath value.
CefSharp.xml:7324:             a given CefSettings.RootCachePath value. On relaunch the app checks a
kv@DESKTOP-FOOBAR2:/mnt/c/Users/kv/Documents/GitHub/quest/Quest/bin/x86/Debug$

@TextMisadventures
Copy link
Contributor

I don't have a clue how to handle this. I tried again for a good while just now. I found quite a few places where people advised going by this: https://github.com/cefsharp/CefSharp/blob/v130.1.90/CefSharp.Example/CefExample.cs

Looking at that makes me even more confused. This is over my head. I don't even know what to begin to do with that example.

@KVonGit
Copy link
Collaborator Author

KVonGit commented Dec 10, 2024

The root cache path has to be set somewhere already, because localStorage is persistent already, and the CEF docs say localStorage will not be persistent without this set.

...but I added code to set it anyway, and I still get the same error after modifying this part of PlayerHTML.vb (and the settings definitely take effect, but I'm 99% sure the only change is that it puts the files in the folder I specify rather than a Windows user app directory or something):

        settings.RegisterScheme(resScheme)
        settings.RootCachePath = My.Application.Info.DirectoryPath() & "\cache\global"

        Cef.Initialize(settings)

I open one instance of Quest and load a game in the player. Then, while that game is running in the player, I open a second instance of Quest and load a second game in that player.

image


These lines appear in the log when starting the second game in the player:

[11212:4900:1209/200152.736:WARNING:chrome_main_delegate.cc(747)] This is Chrome version 130.0.6723.70 (not a warning)
[7788:8116:1209/200155.811:WARNING:chrome_browser_delegate.cc(693)] Creating a chrome browser without a client

At this point, an actual Chrome window is opened.

image


I believe it finds that its browser is already busy (or that it failed to initialize), and it tries to run the second game in Chrome. (Just a wild theory.)


cefsharp/CefSharp#4668 (comment)

This seems to be saying this should have never worked, and that a previous update to CEF "fixes" everything by stopping it from trying to work at all.

@KVonGit
Copy link
Collaborator Author

KVonGit commented Dec 10, 2024

Well, this is most probably bad practice, but this allows two games at once:

        settings.RootCachePath = Path.GetTempPath() & "\quest5-cache" + (Convert.ToInt32((DateTime.Now - (New DateTime(2012, 1, 1))).TotalSeconds)).ToString()

During play, each game has its own localStorage (of course), but that localStorage is rendered inaccessible once the game is closed this way. I also assume this will fill the temp directory up before too long, haha.

I wonder if the game directory can be accessed at this point in this script... Then, each game could have its own persistent localStorage.


Since I have commented so many times here, I am converting this to a Discussion, and an issue without all these comments will be created in this issue's place.

@textadventures textadventures locked and limited conversation to collaborators Dec 10, 2024
@KVonGit KVonGit converted this issue into discussion #1278 Dec 10, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants