java-cef icon indicating copy to clipboard operation
java-cef copied to clipboard

Crash on linux and macOS in multi-threaded applications

Open Rigner opened this issue 7 months ago • 4 comments

Describe the bug Hey, I'm trying to integrate JCEF into an existing application, which is highly multithreaded. Due to its nature, we cannot change that. JCEF crashes with SIGSEGV when initializing, with the same reason as https://github.com/chromiumembedded/java-cef/issues/41.

Unfortunately, the fix that was made there for backing up the signals and restoring them later doesn't work since another thread could cause a SIGSEGV while initializing JCEF, causing java to crash.

Would you have another idea to fix it ? I tried to patch CEF to disable the chromium crash reporter etc, since we don't need it (and it wouldn't work anyway since we're restoring the java signals)~~, but never got it to build properly on my M1 mac (smth to do with sandbox lib).~~ I would rather ask someone who has more experience to implement a proper fix for this.

To Reproduce Steps to reproduce the behavior:

  1. Boot multiple threads with a lot of logic being ran (can just dereference null objects to emulate SIGSEGV NPEs in a loop)
  2. Initialize JCEF
  3. Watch one of these threads crash with a SIGSEGV

Expected behavior JCEF should initialize without any crash

Screenshots N/A

Versions (please complete the following information):

  • OS: macOS 10.13 - 14.5, Ubuntu 22.10 (any macOS or linux)
  • Java Version: OpenJDK 8, 17 and 21
  • JCEF Version: ea25085 (https://github.com/Rigner/java-cef/tree/master which is basically the same as this one with just 1 extra commit)
  • CEF Version: 122.0.6261.112

Additional context All explained above.

Rigner avatar Jul 09 '24 14:07 Rigner