Error moving corrupted cache on load.

Issue #1940 resolved
Brett Allen created an issue

When CEF initializes with a cache path set, and the cache is invalid, it tries to move the cache and regenerate it, but moving fails. Result is the cache switches to in memory usage.

The reason moving the corrupted cache appears to be due to Visited Links file being open by the new CEF process, so the folder move is blocked by the OS.

OS: Windows Server 2012 R2 Standard libcef.dll Version: 3.2623.1396.0 CefSharp Version: 49

Attached screenshot of console error log.

Comments (8)

  1. Dmitry Azaraev

    It should not be depends on visited links file - this bug has been in CEF before visited links has been introduced.

  2. Marshall Greenblatt

    Why is the cache invalid? Do you have another version of CEF still running that shares the same cache directory?

  3. Dmitry Azaraev

    Abnormal process termination can corrupt cache. Broken and repaired FS can corrupt cache. User with too long hands can corrupt it too. It is infinite possibilities. :)

  4. Dmitry Azaraev

    @magreenblatt CEF by default uses different directory layout: mix cache files and other data with one directory (via cefclient i'm can't specify user data path, so don't tried it). So it is put cache files and other files like Cookies and Visited Links into one directory. Chrome puts cache files into separate sub directory of user profile directory.

    PS: But originally i'm noted that i'm seen this kind errors far more earlier than Visited Links has been introduced.

  5. Marshall Greenblatt

    @dmitry-azaraev : In that case we should probably put cache files in a separate folder (Cache sub-directory under the path specified by CefSettings.cache_path) to avoid this issue. That seems to be the structure that Chrome uses in C:\Users[user]\AppData\Local\Google\Chrome\User Data\Default.

  6. Brett Allen reporter

    Abnormal process termination is most likely the cause. I still have not figured out how to close the application without causing this. The cache being invalid wasn't my biggest concern, the inability to move it and recreate it was.

    The reason I mentioned Visited Links is when I attempted to delete the invalid cache, that file was still in use for some odd reason and the only process running was the process that just had a problem using the cache.

    I'll check and see if revision 1ee311f fixes it. Thanks Marshall!

    If it's not a huge problem, would you be able to tell me if this is the correct way to shut down a process that initialized CEF? We have a parent process that launches many simultaneously (each with it's own cache paths), and they return the results of the job through redirected STDOUT.

                try
                {
                    Log.Debug("Writing result to EESA STDOUT");
                    Console.WriteLine(JsonConvert.SerializeObject(LaunchedMainJob, DefaultJsonSerializer.DefaultSerializerSettings));
    
                    Cef.Shutdown();
    
                    // Give Cef.Shutdown an attempt to close the process.
                    Thread.Sleep(TimeSpan.FromSeconds(20));
                    Application.Exit();
                }
                finally
                {
                    // Known issue with CEF: https://github.com/cefsharp/CefSharp/issues/990
                    Log.Debug("Process.Exit");
                    Process.GetCurrentProcess().Kill();
                }
    
  7. Log in to comment