Cookies not flushed to disk when closing app immediately

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Cookies not flushed to disk when closing app immediately

Postby Czarek » Tue Nov 25, 2014 11:05 am

I am having this same issue after upgrading my app from branch 1650 to 2171. It looks like CEF does not shutdown properly. I've double checked and both CefQuitMessageLoop() and CefShutdown() are being called. But cookies are not flushed to disk when shutting down app. I am setting cache_path option. These are the steps to reproduce:

1. Launch app
2. Create cookie
3. Close app immediately - CefShutdown is called OK.
4. Now when I relaunch app I see these errors in debug.log:

[1125/165558:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5
[1125/165558:ERROR:cache_util.cc(132)] Unable to move cache folder C:\phpdesktop\phpdesktop-chrome-cef2171\Release\webcache
to C:\phpdesktop\phpdesktop-chrome-cef2171\Release\old_webcache_000
[1125/165558:ERROR:cache_creator.cc(132)] Unable to create cache

5. Cookies that were created in previous launch are not found. This issue is reproducible every time.

If after creating cookie I wait 60 seconds before closing app then cookies are flushed to disk just fine.

It worked fine when my app used branch 1650 and I didn't make any code changes, only updated CEF version. It's strange, but when running cefclient.exe with --cache-path switch this issue doesn't occur.

Issue 1432 may be somewhat related: https://code.google.com/p/chromiumembed ... il?id=1432

Tested on Windos 7 64bit. CEF 3 branch 2171 revision 1902.
Building with VS2010.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Cookies not flushed to disk when closing app immediately

Postby Czarek » Tue Nov 25, 2014 11:46 am

I've looked more closely to cefclient_win.cpp and found that handling WM_DESTROY message differed slightly in my app. I was calling PostQuitMessage(0) in WM_DSTROY when last browser window was being destroyed. I removed it and returned 0 instead and now it works fine. Strange that it worked fine in branch 1650.

The error message "Unable to move the cache: 5" (E_ACCESS_DENIED) is caused because CEF cannot access files. Previous launch of application didn't shut down cleanly. File locks were acquired in cache directory, but they weren't released due to unexpected termination. I think CEF thinks that files are corrupt (because it cannot access them) and tries to delete cache directory (by renaming it to old_cache_000), but it fails due to file locks being held.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: Majestic-12 [Bot] and 69 guests

cron