FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Segmentation fault during release of shared request context. Temporary fix applied. · Issue #333 · cztomczak/cefpython · GitHub

Repository navigation

Segmentation fault during release of shared request context. Temporary fix applied. #333

Closed

Description

This was reproduced in hello_world.py example when running js alert example from w3schools during closing of popup and main windows. Logs and backtrace with gdb:

[CEF Python] Renderer: OnContextCreated()
[CEF Python] Browser: OnProcessMessageReceived(): OnContextCreated
[CEF Python] V8ContextHandler_OnContextCreated()
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 2306 error_code 3 request_code 3 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
[CEF Python] LifespanHandler_OnBeforeClose
[CEF Python] del g_pyFrames[1#2]
[CEF Python] del g_pyFrames[1#5]
[CEF Python] del g_pyFrames[1#-4]
[CEF Python] del g_pyFrames[1#9]
[CEF Python] del g_pyFrames[1#8]
[CEF Python] del g_pyFrames[1#12]
[CEF Python] del g_pyFrames[1#11]
[CEF Python] del g_pyFrames[1#10]
[CEF Python] del g_pyBrowsers[1]
[CEF Python] Renderer: OnContextReleased()
[CEF Python] LifespanHandler_OnBeforeClose
[CEF Python] del g_pyFrames[2#19]
[CEF Python] del g_pyFrames[2#18]
[CEF Python] del g_pyFrames[2#-4]
[CEF Python] del g_pyFrames[2#23]
[CEF Python] del g_pyFrames[2#22]
[CEF Python] del g_pyFrames[2#21]
[CEF Python] del g_pyFrames[2#20]
[CEF Python] del g_pyFrames[2#14]
[CEF Python] del g_pyFrames[2#15]
[CEF Python] RemovePyBrowser: releasing shared request context
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()
[CEF Python] Renderer: OnContextReleased()

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe5031425 in scoped_refptr::operator= (
    this=0x7fffe530f990 <_ZL47__pyx_v_14cefpython_py27_g_sharedRequestContext.20305>, p=0x0)
    at /home/cz/github/cefpython/src/include/base/cef_ref_counted.h:348
348	      old_ptr->Release();

cef_ref_counted.h line 348 is an assignment operator:

  scoped_refptr<T>& operator=(T* p) {
    // AddRef first so that self assignment should work
    if (p)
      p->AddRef();
    T* old_ptr = ptr_;
    ptr_ = p;
    if (old_ptr)
      old_ptr->Release();
    return *this;
  }

There are three being made three NULL assignments to shared request context in CloseBrowser, RemovePyBrowser (called from OnBeforeClose) and in Shutdown:

if g_sharedRequestContext.get():
    g_sharedRequestContext.Assign(NULL)

However as you can see there is always check to .get() before .Assign(), so if the value is NULL a Release() will never be called.

From the logs you can see that there are OnContextReleased callbacks still being called after OnBeforeClose. This is probably some issue with CEF, these calls should happen before OnBeforeClose. Reported on CEF Forum:

https://magpcss.org/ceforum/viewtopic.php?f=6&t=14989

Activity

  1. added this to the v56 milestone on Mar 19, 2017
  2. cztomczak commented on Mar 19, 2017

    OwnerAuthor

    Commit 7f1e84b temporarily fixes issue by not releasing shared request context at all. Seems to work fine. See the commented out code in Shutdown:

         # Release shared request context. This is sometimes causing
         # segmentation fault, so disabling it for now. See Issue #333:
         # https://github.com/cztomczak/cefpython/issues/333
         # OFF: g_shared_request_context.Assign(NULL)
    

    Other calls that released context that were in CloseBrowser and in RemovePyBrowser were removed.

    Keeping this issue still open as waiting for comment from Marshall.

  3. changed the title [-]Segmentation fault during release of shared request context[/-] [+]Segmentation fault during release of shared request context. Temporary fix applied.[/+] on Mar 20, 2017
  4. cztomczak commented on Mar 24, 2017

    OwnerAuthor

    After having a second look at this issue, it looks like segmentation fault might have had something to do the with the BadWindow error that happened earlier. In Issue #334 there was added a call to install x11 error handlers after wx initialization that fixed it. It needs to be retested whether freeing shared request context can be be uncommented and doesn't cause the issue anymore.

  5. cztomczak commented on Aug 17, 2018

    OwnerAuthor

    Did not see any crashes with v66 when temporarily enabled shared request context release. Keeping it still disabled just to be safe.

  6. cztomczak commented on May 8, 2019

    OwnerAuthor
  7. cztomczak commented on Jan 16, 2020

    OwnerAuthor

    This should no longer be a problem with upstream issue 2622 (Network Service).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL