atlas-engineer / nyxt

Nyxt - the hacker's browser.
https://nyxt-browser.com/
9.64k stars 404 forks source link

Memory corruption with webkit 2.44.0 #3382

Closed shamazmazum closed 2 months ago

shamazmazum commented 2 months ago

Hi! I have a memory corruption bug which appears randomly on startup or when switching buffers.

This bug has appeared after webkit update from version 2.42.4 to 2.44.0. My setup:

About two of five launches of nyxt result in UI freeze (because the corruption happens in GTK main thread).

This is what I have got from debugger (the bug happened when switching buffers with C-x b):

<INFO> [14:02:00] Pressed keys: C-x

(nyxt:6600): Gdk-CRITICAL **: 14:02:06.011: gdk_window_create_gl_context: assertion 'GDK_IS_WINDOW (window)' failed
 in SBCL pid 6600 pthread 0x839214400:
Memory fault at 0x8 (pc=0x83b6d1f43, fp=0x84ebff600, sp=0x84ebff5d0) pthread 0x839214400
The integrity of this image is possibly compromised.
Continuing with fingers crossed.

debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD tid=296374 "cl-cffi-gtk main thread" RUNNING {1030AAC4A3}>:
  Unhandled memory fault at #x8.

The current thread is not at the foreground,
SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD tid=287940 "main thread" RUNNING {1000000113}>
for this thread to enter the debugger.
(sb-thread:release-foreground)
Resuming thread #<THREAD tid=296374 "cl-cffi-gtk main thread" RUNNING {1030AAC4A3}>

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] abort thread
             (#<THREAD tid=296374 "cl-cffi-gtk main thread" RUNNING
                 {1030AAC4A3}>)

("bogus stack frame")NIL
0] backtrace

Backtrace for: #<SB-THREAD:THREAD tid=296374 "cl-cffi-gtk main thread" RUNNING {1030AAC4A3}>
0: ("bogus stack frame")
1: ("foreign function: webkit_print_custom_widget_get_title")
2: ("foreign function: _ZN6WebKit18NetworkProcessMainEiPPc")
3: ("foreign function: webkit_user_message_send_reply")
4: ("foreign function: _ZN6WebKit18NetworkProcessMainEiPPc")
5: ("foreign function: _ZN6WebKit18NetworkProcessMainEiPPc")
6: ("foreign function: _ZNK3WTF7RunLoop9isCurrentEv")
7: ("foreign function: _ZNK3WTF7RunLoop9TimerBase16secondsUntilFireEv")
8: ("foreign function: _ZN3WTF14GSocketMonitor5startEP8_GSocket12GIOConditionRNS_7RunLoopEONS_8FunctionIFiS3_EEE")
9: ("foreign function: g_main_context_dispatch")
10: ("foreign function: g_main_context_pending")
11: ("foreign function: g_main_loop_run")
12: ("foreign function: gtk_main")
13: (GTK::%GTK-MAIN)
14: ((LAMBDA NIL :IN GTK:ENSURE-GTK-MAIN))
15: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
16: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
17: ((FLET "WITHOUT-INTERRUPTS-BODY-" :IN SB-THREAD::RUN))
18: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
19: ((FLET "WITHOUT-INTERRUPTS-BODY-" :IN SB-THREAD::RUN))
20: (SB-THREAD::RUN)
21: ("foreign function: call_into_lisp_")
22: ("foreign function: funcall1")

This is not very informative for me :)

The issue may be FreeBSD related and has nothing to do with Nyxt, but a simple browser from cl-webkit2 always starts without issues and works fine. Has anyone already tried Nyxt with WebKit 2.44.0?

aadcg commented 2 months ago

@shamazmazum thanks for the report.

Nyxt 3.11.6 is packaged for Flatpak and it is running with WebKitGTK 2.44.0 without issues.

shamazmazum commented 2 months ago

@aadcg Thanks! It seems, this bug is related to FreeBSD only. Should I close it?

aadcg commented 2 months ago

@shamazmazum FreeBSD isn't a platform that we officially support, but patches are welcomed!

Please re-open if you find these issues on the Flatpak or other non-official distribution that runs on Linux.