Cookie sqlite errors on shutdown

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.

Cookie sqlite errors on shutdown

Postby Czarek » Sat Feb 15, 2014 9:25 am

Hi,

When closing app got these errors:

[0215/152257:ERROR:backend_impl.cc(1962)] Invalid file version or magic
[gtk] export.go:13: _GoDestroySignal
[cef] cef.go:240: QuitMessageLoop
[cef] cef.go:245: Shutdown
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: UPDATE cookies SET last_access_utc=? WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: UPDATE cookies SET last_access_utc=? WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: DELETE FROM cookies WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: INSERT INTO cookies (creation_utc, host_key, name, value, encrypted_value, path, expires_utc, secure, httponly, last_access_utc, has_expires, persistent, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: DELETE FROM cookies WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: INSERT INTO cookies (creation_utc, host_key, name, value, encrypted_value, path, expires_utc, secure, httponly, last_access_utc, has_expires, persistent, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: UPDATE cookies SET last_access_utc=? WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: UPDATE cookies SET last_access_utc=? WHERE creation_utc=?
[0215/152258:ERROR:connection.cc(1034)] Cookie sqlite error 1, errno 0: SQL logic error or missing database, sql: COMMIT


Also there is some error in "backend_impl.cc" at the beginning of the logs.

Happened only once when stress testing application launching.

Using CEF 3 branch 1750 revision 1604 on Ubuntu 64-bit.

Best regards.
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: Cookie sqlite errors on shutdown

Postby tomst » Fri Oct 24, 2014 4:56 pm

Do you have a resolution for this? My app on the Mac loses local storage and cookies when I restart it. I repeatedly get this error in the log (when using local storage / cookies, not related to the shutdown of the app):

Code: Select all
[1024/144912:ERROR:connection.cc(1060)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: INSERT INTO cookies (creation_utc, host_key, name, value, encrypted_value, path, expires_utc, secure, httponly, last_access_utc, has_expires, persistent, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
...
[1024/145056:ERROR:connection.cc(1060)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: INSERT INTO cookies (creation_utc, host_key, name, value, encrypted_value, path, expires_utc, secure, httponly, last_access_utc, has_expires, persistent, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
[1024/145056:ERROR:connection.cc(1060)] Cookie sqlite error 1, errno 0: SQL logic error or missing database, sql: COMMIT


I tried setting different cache paths (e.g. /tmp/cef_cache and also in the Application Support folder) with the same results. Any suggestions on how to debug this issue? I disabled CEF sandboxing using cefSettings.no_sandbox = true, and I also disabled Apple's sandboxing on both the main app and the helper.

I am using the 2171 branch.
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby magreenblatt » Fri Oct 24, 2014 5:29 pm

Are you shutting down cleanly? (i.e. close all browsers, wait for OnBeforeClose, call CefQuitMessageLoop, wait for CefInitialize to return, call CefShutdown)
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Sat Oct 25, 2014 1:05 pm

Unlike Czarek, I'm getting the error while the app is running and trying to write cookies or local storage, and not at time of shutdown, so it's not related to shutting down the app.
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Mon Oct 27, 2014 7:11 pm

Any further ideas? When I remove the cache path and freshly start the app, everything works well. However, on a subsequent start of the app I'm getting errors.

I traced system calls using dtruss and my suspicion is that some code renames the cache path to "old_..." (why does it do that?), unlinks the Cookies file and then SQLite has the old file handle still open and gets an I/O error. Not sure how to verify that this is actually the case, but here are some relevant parts of the trace:

Code: Select all
rename("/tmp/cef_cache_path\0", "/tmp/old_cef_cache_path_000\0")                 = 0 0
...
unlink("/tmp/old_cef_cache_path_000/Cookies\0", 0x7F91C40D1400, 0x1000)          = 0 0
unlink("/tmp/old_cef_cache_path_000/Cookies-journal\0", 0x7F91C40D1400, 0x1000)          = 0 0
unlink("/tmp/old_cef_cache_path_000/data_0\0", 0x7F91C40D1400, 0x1000)           = 0 0
...
access("/tmp/cef_cache_path\0", 0x0, 0x100)              = 0 0
stat64("/tmp/cef_cache_path/Cookies\0", 0x1157C9778, 0x100)              = -1 Err#2
stat64("/tmp/cef_cache_path/Cookies\0", 0x1157C9728, 0x100)              = -1 Err#2
stat64("/tmp/cef_cache_path/Cookies\0", 0x1157C7F38, 0x100)              = -1 Err#2
...
[1027/163125:ERROR:connection.cc(1060)] Cookie sqlite error 1802, errno 0: disk I/O error, sql: INSERT INTO cookies (creation_utc, host_key, name, value, encrypted_value, path, expires_utc, secure, httponly, last_access_utc, has_expires, persistent, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)


If there's any more details I can provide I'm more than happy to do so. Can anyone explain why the cache directory gets renamed (and where it happens)?
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Tue Oct 28, 2014 7:09 pm

I also double checked my shutdown procedure and it should be correct. OnBeforeClose is called for every browser and I call CefShutdown in the app delegate's applicationWillTerminate (CefInitialize returns immediately). I don't explicitly call CefQuitMessageLoop.
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Tue Oct 28, 2014 9:37 pm

Also, everything seems to work great if I run chmod -w on the parent directory (so that the cache directory can't be moved). Cookies etc. then persist across restarts as expected. Only thing is I get the following lines in the log:

Code: Select all
[1028/193141:ERROR:cache_util.cc(132)] Unable to move cache folder /Users/tom/Library/Application Support/myapp/cef_cache to /Users/tom/Library/Application Support/myapp/old_cef_cache_000
[1028/193141:ERROR:cache_creator.cc(132)] Unable to create cache


Any suggestions on what could make Chromium think the cache directory needs to be moved and unlinked? Also, in the case where cache directory is actually corrupt and needs to be moved and unlinked, any SQLite file descriptors should be opened only *after* this happens.
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Thu Oct 30, 2014 2:43 am

This happens with the cefclient as well.

Code: Select all
% mkdir /tmp/cache_container
% mkdir /tmp/cache_container/cache
% chmod -w /tmp/cache_container
% ~/cef/chromium/src/cef/binary_distrib/cef_binary_3.2171.1885_macosx64/xcodebuild/Release/cefclient.app/Contents/MacOS/cefclient --cache-path /tmp/cache_container/cache
^C
% ~/cef/chromium/src/cef/binary_distrib/cef_binary_3.2171.1885_macosx64/xcodebuild/Release/cefclient.app/Contents/MacOS/cefclient --cache-path /tmp/cache_container/cache
[1030/003652:ERROR:cache_util.cc(132)] Unable to move cache folder /tmp/cache_container/cache to /tmp/cache_container/old_cache_000
[1030/003652:ERROR:cache_creator.cc(132)] Unable to create cache


When looking at ./chromium/src/net/disk_cache/cache_util.cc, it attempts to move it in DelayedCacheCleanup which is called from CacheCreator::OnIOComplete and only called when there's a failure initializing the cache. Why would there be a failure?
tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm

Re: Cookie sqlite errors on shutdown

Postby magreenblatt » Tue Nov 11, 2014 10:02 am

Can you add a bug for this? Thanks.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: Cookie sqlite errors on shutdown

Postby tomst » Thu Nov 13, 2014 6:41 pm

tomst
Techie
 
Posts: 43
Joined: Fri Aug 22, 2014 4:38 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 50 guests