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

Segfault on Linux when trying to run the cefsimple example #3

Open
antoyo opened this issue Mar 8, 2020 · 19 comments
Open

Segfault on Linux when trying to run the cefsimple example #3

antoyo opened this issue Mar 8, 2020 · 19 comments
Assignees

Comments

@antoyo
Copy link

antoyo commented Mar 8, 2020

Hi.
Here's the stacktrace in gdb:

#0  0x000055555581f640 in  ()
#1  0x0000555555581b05 in <cef::refcounted::RefCountedPtr<C> as core::ops::drop::Drop>::drop (self=0x7fffffffc4b0) at src/refcounted.rs:182
#2  0x0000555555565c3f in core::ptr::real_drop_in_place () at /rustc/3a3f4a7cbaff09722b8c7cc8f09ce86ff5f953a3/src/libcore/ptr/mod.rs:184
#3  0x00005555555659ee in core::ptr::real_drop_in_place () at /rustc/3a3f4a7cbaff09722b8c7cc8f09ce86ff5f953a3/src/libcore/ptr/mod.rs:184
#4  0x00005555555641b5 in cef::client::ClientCallbacks::on_process_message_received
    (self=0x5555557de7b0, browser=..., frame=..., process_id=(cef::process::ProcessId::Renderer | unknown: 2), message=...)
    at /cef/src/client.rs:101
#5  0x000055555557d21b in <cef::client::ClientWrapper as cef::client::ClientWrapper::process_message_received::Impl>::inner
    (self=0x5555557c1030, browser=..., frame=..., source_process=(cef::process::ProcessId::Renderer | unknown: 2), message=...) at src/client.rs:157
#6  cef::client::ClientWrapper::process_message_received
    (self_=0x5555557c0f90, browser=0x5555557dccc0, frame=0x5555555a73fb <core::sync::atomic::atomic_add+139>, source_process=3, message=0x5555557df860)
    at src/extern_callback_helpers.rs:361
#7  0x00007ffff1894529 in  () at /opt/cef/Release/libcef.so
#8  0x00007ffff3881a14 in  () at /opt/cef/Release/libcef.so
#9  0x00007ffff5d6a480 in  () at /opt/cef/Release/libcef.so
#10 0x00007ffff5d6a0c7 in  () at /opt/cef/Release/libcef.so
#11 0x00007ffff24bbc5e in  () at /opt/cef/Release/libcef.so
#12 0x00007ffff24b701c in  () at /opt/cef/Release/libcef.so
#13 0x00007ffff24b629f in  () at /opt/cef/Release/libcef.so
#14 0x00007ffff24bda1c in  () at /opt/cef/Release/libcef.so
#15 0x00007ffff24a5029 in  () at /opt/cef/Release/libcef.so
#16 0x00007ffff24a4b28 in  () at /opt/cef/Release/libcef.so
#17 0x00007ffff24a4a5a in  () at /opt/cef/Release/libcef.so
#18 0x00007ffff386c71b in  () at /opt/cef/Release/libcef.so
#19 0x00007ffff386bd5a in  () at /opt/cef/Release/libcef.so
#20 0x00007ffff386b5d1 in  () at /opt/cef/Release/libcef.so
#21 0x00007ffff188c480 in cef_browser_host_create_browser_sync () at /opt/cef/Release/libcef.so
#22 0x000055555557e2f7 in cef::browser_host::BrowserHost::create_browser_sync
    (window_info=0x7fffffffe170, client=..., url=..., settings=0x7fffffffe1f0, extra_info=..., request_context=..., context=0x7fffffffe088) at src/browser_host.rs:109
#23 0x0000555555563981 in cefsimple::main () at examples/cefsimple/main.rs:71

Here are the logs (change at every execution):

[0308/191812.147959:INFO:main.rs(54)] Startup
[0308/191812.148052:INFO:main.rs(69)] Opening browser window
[0308/191812.190522:ERROR:sandbox_linux.cc(368)] InitializeSandbox() called with multiple threads in process gpu-process.
[0100/000000.981559:ERROR:broker_posix.cc(43)] Invalid node channel message
fish : Tâche , './target/debug/examples/cefsimp…' terminée par le signal SIGSEGV (Erreur de frontière d'adresse)

Any idea of what could be the issue?
Thanks.

@anlumo
Copy link
Member

anlumo commented Mar 8, 2020

I haven't seen that one. Maybe you could try turning off the sandbox feature (in CefSettings) to see if that fixes the example?

@antoyo
Copy link
Author

antoyo commented Mar 8, 2020

Can you tell me which file I need to edit?

@anlumo
Copy link
Member

anlumo commented Mar 8, 2020

Here are the settings: https://github.com/anlumo/cef/blob/8841465178fecac6176ed9fe0e7163d784144d66/examples/cefsimple/main.rs#L46

Note that I haven't tested the cefsimple example in a while.

@antoyo
Copy link
Author

antoyo commented Mar 8, 2020

As far as I understand the code, this example is already supposed to disable the sandbox because Context::initialize is called with the sandbox_info argument being None which in turns call to_cef() with sandbox_info.is_some() as the use_sandbox argument.

Am I mistaken or should I do something else to disable the sandbox?

@anlumo
Copy link
Member

anlumo commented Mar 8, 2020

I believe that specific parameter is only relevant to Windows.

@antoyo
Copy link
Author

antoyo commented Mar 8, 2020

I still don't understand.
Can you tell me what should I change in the code please?

@anlumo
Copy link
Member

anlumo commented Mar 8, 2020

Hmm I just dove through the extraction of the settings and you're right, @Osspial changed it so that this parameter actually turns off the sandbox on all platforms.

@Osspial maybe you have an idea what's wrong?

@antoyo
Copy link
Author

antoyo commented Mar 25, 2020

Any news on that?
Is there any way I can help you debug this?

@Osspial
Copy link
Contributor

Osspial commented Mar 25, 2020

Could you try updating to the latest master? It looks like there was a memory management bug in BrowserHost::create_browser_sync.

@antoyo
Copy link
Author

antoyo commented Mar 25, 2020

It seems to be fixed, but now it segfaults in libcef.so.
Do I need to use the same CEF version as you (I read something about that when I was trying myself to create a libcef binding for Rust)?
If so, could you please write in the readme the exact version of CEF this crate is for?

@anlumo
Copy link
Member

anlumo commented Mar 25, 2020

Well, sometimes CEF versions add incompatible changes, but most are compatible to each other. We're currently using version 79.1.26+g50b44dc+chromium-79.0.3945.117.

I've tried updating to a newer version, but the C++ code doesn't compile for me any more for some reason. I have to look into this when I have some time.

@Osspial
Copy link
Contributor

Osspial commented Mar 31, 2020

@antoyo Could you post a stacktrace with the new segfault? I'm not entirely sure how to get symbols in libcef to show up the stack trace, but it'd be helpful to get those.

@antoyo
Copy link
Author

antoyo commented Apr 18, 2020

When I run in debug mode, it doesn't segfault, but does not work either:

[0418/120638.395207:INFO:content_main_runner_impl.cc(957)] Chrome is running in full browser mode.
[0418/120638.426021:INFO:main.rs(54)] Startup
[0418/120638.426091:INFO:main.rs(69)] Opening browser window
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Serial number of failed request:  292
  Current serial number in output stream:  294
[0418/120638.448155:FATAL:context.cc(58)] Check failed: !g_context. CefShutdown was not called
[0418/120638.483493:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
[0418/120638.645263:INFO:child_thread_impl.cc(831)] ChildThreadImpl::EnsureConnected()
[0418/120638.673531:INFO:child_thread_impl.cc(831)] ChildThreadImpl::EnsureConnected()
fish: 'cargo run --example cefsimple' terminated by signal SIGTRAP (Trace or breakpoint trap)

I'm having a hard time compiling CEF with the options I want, but I think this time I was able to disable the sandbox as well.

Can I provide more info?

@Osspial
Copy link
Contributor

Osspial commented May 1, 2020

Hmm. It's not clear whether or not that's an error on our part - can you try running the official cefsimple example from here and see if that results in the same error?

@antoyo
Copy link
Author

antoyo commented May 6, 2020

The cefsimple example from my installation works.
From what I found on the web, that might be related to focusing the window at the wrong moment.
I'll try to investigate that.
Can you point me to where in the code is the focusing done?

@llacroix
Copy link

Hmm I'm having similar issues running cefsimple

@Osspial
Copy link
Contributor

Osspial commented Jun 30, 2020

I've been able to reproduce the X error on my system. Could you check to see if cefsimple works on the latest master?

@antoyo
Copy link
Author

antoyo commented Jul 1, 2020

Yeah, now the window is shown.
Thanks for the fix.

There's an issue on exit, I think:

woo linux
[0701/111718.924984:WARNING:resource_bundle.cc(1078)] unable to find resource: 10000
[0701/111718.925295:WARNING:resource_bundle.cc(1078)] unable to find resource: 15090
[0701/111718.925320:WARNING:resource_bundle.cc(1078)] unable to find resource: 15090
[0701/111718.925364:WARNING:resource_bundle.cc(1078)] unable to find resource: 15091
[0701/111718.925418:WARNING:resource_bundle.cc(1078)] unable to find resource: 10100
[0701/111718.925444:WARNING:resource_bundle.cc(1078)] unable to find resource: 10101
[0701/111718.925470:WARNING:resource_bundle.cc(1078)] unable to find resource: 10102
[0701/111718.925495:WARNING:resource_bundle.cc(1078)] unable to find resource: 10103
[0701/111718.925520:WARNING:resource_bundle.cc(1078)] unable to find resource: 10105
[0701/111718.925544:WARNING:resource_bundle.cc(1078)] unable to find resource: 10106
[0701/111718.925567:WARNING:resource_bundle.cc(1078)] unable to find resource: 10107
[0701/111718.926265:WARNING:resource_bundle.cc(1078)] unable to find resource: 10108
[0701/111718.926292:WARNING:resource_bundle.cc(1078)] unable to find resource: 10109
[0701/111718.928564:INFO:main.rs(88)] Startup
[0701/111718.928623:INFO:main.rs(103)] Opening browser window
[0701/111718.939241:WARNING:main.rs(44)] X error received: 
type 0
serial 292
error_code 8
request_code 42

minor_code 0
[0701/111718.948279:INFO:main.rs(115)] Running message loop
[0701/111718.970041:WARNING:resource_bundle.cc(1078)] unable to find resource: 27303
[0701/111718.970100:WARNING:resource_bundle.cc(1078)] unable to find resource: 27304
[0701/111718.971121:WARNING:resource_bundle.cc(1078)] unable to find resource: 27303
[0701/111718.971168:WARNING:resource_bundle.cc(1078)] unable to find resource: 27304
[0701/111719.006685:ERROR:sandbox_linux.cc(372)] InitializeSandbox() called with multiple threads in process gpu-process.
[0701/111719.036092:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
drop poisoned
[0701/111720.134869:WARNING:main.rs(44)] X error received: 
type 0
serial 400
error_code 3
request_code 20

minor_code 0
[0701/111720.135172:WARNING:main.rs(44)] X error received: 
type 0
serial 401
error_code 3
request_code 129

minor_code 1
[0701/111720.137661:INFO:main.rs(119)] Quit
drop context
fish: 'cargo run --bin cefsimple' terminated by signal SIGTRAP (Trace or breakpoint trap)

@anlumo
Copy link
Member

anlumo commented Jul 2, 2020

That error is caused by something not cleaning up all objects that were created for CEF.

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

No branches or pull requests

4 participants