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

Cookies not flushed to disk when closing app immediately in wxpython.py (Linux yet to fix) #158

Closed
GoogleCodeExporter opened this issue Aug 28, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Noticed this behavior after setting the "cache_path" option in the wxpython.py 
example (it also required setting path in the GetCookieManager callback).

Cookies are flushed to disk only after about 30 seconds. If app is closed 
before that, cookies do not persist.

This is similar to a recent issue I've reported for the PHP Desktop project: 
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=12357

Original issue reported on code.google.com by czarek.t...@gmail.com on 11 Jan 2015 at 2:15

@GoogleCodeExporter
Copy link
Author

Cookies are flushed to disk just fine in the pywin32.py and pyqt.py examples. 
So looks like this is wxPython only issue.

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 2:52

  • Changed title: Cookies not flushed to disk when closing app immediately (wxpython.py)

@GoogleCodeExporter
Copy link
Author

Changed OnClose to this:

    if self.browser:
        self.browser.StopLoad()
        self.browser.CloseBrowser(True)
        del self.clientHandler.mainBrowser
        del self.browser
        self.Destroy()

This helped and log messages appear in the right order now - browser is 
destroyed before Shutdown() is called:

    [CEF Python] CefBrowser::CloseBrowser(True)
    [wxpython.py] LifespanHandler::OnBeforeClose
        browserId=1
    [CEF Python] del g_pyFrames[1#1]
    [CEF Python] del g_pyFrames[1#16]
    [CEF Python] del g_pyFrames[1#15]
    [CEF Python] del g_pyFrames[1#14]
    [CEF Python] del g_pyFrames[1#13]
    [CEF Python] del g_pyFrames[1#12]
    [CEF Python] del g_pyFrames[1#11]
    [CEF Python] del g_pyFrames[1#18]
    [CEF Python] del g_pyBrowsers[1]
    [wxpython.py] MyApp.OnExit
    [CEF Python] Shutdown()

However there is still issue with cookies not flushed. Additionaly these sqlite 
cookie errors started appearing in console:

  [CEF Python] del g_pyBrowsers[1]
  [wxpython.py] MyApp.OnExit
  [CEF Python] Shutdown()
  [0111/165253:WARNING:sqlite_persistent_cookie_store.cc(1134)] Failed to post task from content::SQLitePersiste
      ntCookieStore::Backend::Close@browser\net\sqlite_persistent_cookie_store.cc:1021 to background_task_runner_.
  [0111/165253:ERROR_REPORT:sqlite_persistent_cookie_store.cc(121)] Check failed: !db_.get(). Close should have
      already been called.
  [0111/165253:ERROR_REPORT:sqlite_persistent_cookie_store.cc(122)] Check failed: num_pending_ == 0 
      && pending_.empty().

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 4:02

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision 211e1dae20b0.

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 4:32

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

There was still an alive CEF browser reference in the JavascriptExternal 
object. The deletion of pyBrowsers and pyFrames occurs after the call to 
Shutdown(), but it doesn't matter, browser shuts down cleanly and cookies are 
written to disk OK when closing app immediately.

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 4:32

@GoogleCodeExporter
Copy link
Author

Still TODO: update wxpython.py examples on Linux and Mac.

Original comment by czarek.t...@gmail.com on 11 Jan 2015 at 4:37

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Mac scripts were updated. Linux still to do.

Original comment by czarek.t...@gmail.com on 12 Jan 2015 at 10:19

@cztomczak cztomczak changed the title Cookies not flushed to disk when closing app immediately (wxpython.py) Cookies not flushed to disk when closing app immediately in wxpython.py (Linux yet to fix) Feb 11, 2016
@cztomczak cztomczak added the bug label Jun 28, 2016
@cztomczak
Copy link
Owner

cztomczak commented Feb 24, 2017

In v55 there was code added in cefpython.pyx that makes sure that shutdown executes cleanly and if not an "ERROR" message is displayed and logged to debug.log. Even if shutdown is not clean, in such case the code in cefpython.pyx will try to force close browsers, give it some time to close and only then shutdown. So far all works good.

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

No branches or pull requests

2 participants