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

Multiple calls to CefDoMessageLoopWork required before shutdown. Test with External Message Pump. #245

Closed
cztomczak opened this issue Jul 22, 2016 · 3 comments
Labels

Comments

@cztomczak
Copy link
Owner

Fix was already added in commits d9bbf7c and 8d2c1e7, but this might not be enough.

In upstream cefclient there is a 0.05 sec sleep before each call to message loop work, so that CEF has time to process it. Looks like we also need to add it in CEF Python. I thought CefDoMessageLoopWork() was blocking, but if the sleep is required, then it means that it executes asynchronously and returns immediately.

  // We need to run the message pump until it is idle. However we don't have
  // that information here so we run the message loop "for a while".
  for (int i = 0; i < 10; ++i) {
    // Do some work.
    CefDoMessageLoopWork();

    // Sleep to allow the CEF proc to do work.
    usleep(50000);
  }

In discussion [2] Marshall states that this will hopefully be fixed as part of Issue 1805 (external message pump). So if message loop work is implemented using external pump maybe this fix won't be required any more - needs testing.

Related forum discussions:

  1. https://magpcss.org/ceforum/viewtopic.php?p=30858#p30858
  2. https://magpcss.org/ceforum/viewtopic.php?f=6&t=13994#p30093
@cztomczak cztomczak added the bug label Jul 22, 2016
@cztomczak cztomczak changed the title CEF shutdown issues - 10 calls to CefDoMessageLoopWork required before shutdown CEF shutdown errors - 10 calls to CefDoMessageLoopWork required before shutdown Jul 22, 2016
@cztomczak
Copy link
Owner Author

cztomczak commented Dec 17, 2016

Additional changes commited in bfc0a25 as part of Issue #282 ("Not a clean shutdown in examples, when closing app while browser is still loading a website"). Related comments and new code here:

# Run some message loop work, force closing browsers and then run
.

@cztomczak cztomczak changed the title CEF shutdown errors - 10 calls to CefDoMessageLoopWork required before shutdown Multiple calls to CefDoMessageLoopWork required before shutdown. Test with External Message Pump. Feb 24, 2017
@cztomczak
Copy link
Owner Author

Keeping this still Open - maybe these additional calls with sleep shouldn't be executed when using external message pump (#246). Pump was already implemented, but it actually makes app x2 slower on Linux, it's a bug in ustream.

@cztomczak
Copy link
Owner Author

CefDoMessageLoopWork is called in sample implementation of external message pump in upstream cefclient. See https://github.com/chromiumembedded/cef/blob/2773518869b5f57a848e807ddb2ee30adbf1c255/tests/shared/browser/main_message_loop_external_pump_linux.cc#L215 .

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

No branches or pull requests

1 participant