Summary: | devel/geany: Sometimes geany exited on signal 10 (SIGBUS) | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Hodong <hodong> | ||||||
Component: | Individual Port(s) | Assignee: | Guido Falsi <madpilot> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | bar | ||||||
Priority: | --- | Flags: | madpilot:
maintainer-feedback+
|
||||||
Version: | Latest | ||||||||
Hardware: | amd64 | ||||||||
OS: | Any | ||||||||
See Also: | https://github.com/geany/geany/pull/2634 | ||||||||
Attachments: |
|
Description
Hodong
2020-10-16 17:55:11 UTC
Hi, This one is quote difficult to diagnose. Please keep in mind I'm only maintaining a port, and not developing geany, I have no deep knowledge of geany internals. It would be helpful if you could rebuild geany and maybe glib with debug symbols. In this way we could get a better backtrace. The unnamed symbols are not helpful. A few questions to try to narrow down the problem: Are you building ports with poudriere or directly on the live system? In both cases could you try rebuilding and reinstalling gtk3, glib, geany and it's plugins? Sometimes this kind of issues happens due to some library being updated from below a package and causing the breakage. In this case glib got a big update and could really be causing this. For me geany always exits with SIBGUS on CURRENT while it's ok on 12.2-STABLE. It should not depends on installed plugins. Below the backtrace after rebuilding devel/geany devel/glib20 x11-toolkits/vte3(*) x11-toolkits/gtk30. (*) that' because even if the ports depends on x11-toolkis/vte files from x11-toolkits/vte3 are listed in the backtrace. Feel free to ask if you need any other test. $ lldb `which geany` --core geany.core (lldb) target create "/usr/local/bin/geany" --core "geany.core" Core file '/home/bar/geany.core' (x86_64) was loaded. (lldb) bt * thread #1, name = 'geany', stop reason = signal SIGBUS * frame #0: 0x0000000800401793 libgeany.so.0`vte_start(widget=0x00000008054e5b50) at vte.c:497:38 frame #1: 0x00000008015b9ea8 libgobject-2.0.so.0`g_cclosure_marshal_VOID__INTv(closure=0x00000008058eb950, return_value=0x0000000000000000, instance=0x00000008054e5b50, args=0x00007fffffffd520, marshal_data=0x0000000000000000, n_params=1, param_types=0x0000000805520748) at gmarshal.c:596:3 frame #2: 0x00000008015b5827 libgobject-2.0.so.0`_g_closure_invoke_va(closure=0x00000008058eb950, return_value=0x0000000000000000, instance=0x00000008054e5b50, args=0x00007fffffffd520, n_params=1, param_types=0x0000000805520748) at gclosure.c:873:7 frame #3: 0x00000008015d8bd3 libgobject-2.0.so.0`g_signal_emit_valist(instance=0x00000008054e5b50, signal_id=400, detail=0, var_args=0x00007fffffffd520) at gsignal.c:3403:8 frame #4: 0x00000008015da2d7 libgobject-2.0.so.0`g_signal_emit(instance=0x00000008054e5b50, signal_id=400, detail=0) at gsignal.c:3550:3 frame #5: 0x0000000805e3d832 libvte-2.91.so`vte::platform::Widget::emit_child_exited(this=0x00000008054e59e0, status=9) at widget.cc:247:9 frame #6: 0x0000000805e3d7ad libvte-2.91.so`vte::platform::Widget::dispose(this=0x00000008054e59e0) at widget.cc:239:17 frame #7: 0x0000000805e204b0 libvte-2.91.so`vte_terminal_dispose(object=0x00000008054e5b50) at vtegtk.cc:590:35 frame #8: 0x00000008015beb08 libgobject-2.0.so.0`g_object_run_dispose(object=0x00000008054e5b50) at gobject.c:1226:3 frame #9: 0x00000008010ab3fa libgtk-3.so.0`gtk_widget_destroy(widget=0x00000008054e5b50) at gtkwidget.c:4776:5 frame #10: 0x00000008004001b2 libgeany.so.0`vte_close at vte.c:402:2 frame #11: 0x00000008003ad9af libgeany.so.0`do_main_quit at libmain.c:1353:25 frame #12: 0x00000008003ad43b libgeany.so.0`main_quit at libmain.c:1415:7 frame #13: 0x00000008003a2641 libgeany.so.0`cb_func_file_action(key_id=140) at keybindings.c:1487:4 frame #14: 0x00000008003a20a4 libgeany.so.0`run_kb(kb=0x00000008006344f0, group=0x0000000800634810) at keybindings.c:1335:13 frame #15: 0x00000008003a0e5f libgeany.so.0`on_key_press_event(widget=0x00000008050a2540, ev=0x00000008053b0470, user_data=0x0000000000000000) at keybindings.c:1393:9 frame #16: 0x000000080112e4d1 libgtk-3.so.0`_gtk_marshal_BOOLEAN__BOXED(closure=0x00000008057402e0, return_value=0x00007fffffffdb80, n_param_values=2, param_values=0x00007fffffffdbb0, invocation_hint=0x00007fffffffdb68, marshal_data=0x0000000000000000) at gtkmarshalers.c:83:14 frame #17: 0x00000008015b53c5 libgobject-2.0.so.0`g_closure_invoke(closure=0x00000008057402e0, return_value=0x00007fffffffdb80, n_param_values=2, param_values=0x00007fffffffdbb0, invocation_hint=0x00007fffffffdb68) at gclosure.c:810:7 frame #18: 0x00000008015d7e4d libgobject-2.0.so.0`signal_emit_unlocked_R(node=0x000000080342df20, detail=0, instance=0x00000008050a2540, emission_return=0x00007fffffffe028, instance_and_params=0x00007fffffffdbb0) at gsignal.c:3738:8 frame #19: 0x00000008015d9ac7 libgobject-2.0.so.0`g_signal_emit_valist(instance=0x00000008050a2540, signal_id=68, detail=0, var_args=0x00007fffffffe280) at gsignal.c:3504:7 frame #20: 0x00000008015da2d7 libgobject-2.0.so.0`g_signal_emit(instance=0x00000008050a2540, signal_id=68, detail=0) at gsignal.c:3550:3 frame #21: 0x00000008010b21d8 libgtk-3.so.0`gtk_widget_event_internal(widget=0x00000008050a2540, event=0x00000008053b0470) at gtkwidget.c:7808:4 frame #22: 0x00000008010b1ea4 libgtk-3.so.0`gtk_widget_event(widget=0x00000008050a2540, event=0x00000008053b0470) at gtkwidget.c:7378:10 frame #23: 0x0000000800eab713 libgtk-3.so.0`propagate_event(widget=0x00000008050a2540, event=0x00000008053b0470, captured=0, topmost=0x0000000000000000) at gtkmain.c:2680:29 frame #24: 0x0000000800eaac30 libgtk-3.so.0`gtk_propagate_event(widget=0x00000008050a2540, event=0x00000008053b0470) at gtkmain.c:2724:3 frame #25: 0x0000000800eaa4b7 libgtk-3.so.0`gtk_main_do_event(event=0x00000008053b0470) at gtkmain.c:1920:9 frame #26: 0x00000008006c3cf5 libgdk-3.so.0`_gdk_event_emit(event=0x00000008053b0470) at gdkevents.c:73:5 frame #27: 0x0000000800717666 libgdk-3.so.0`gdk_event_source_dispatch(source=0x000000080343a680, callback=0x0000000000000000, user_data=0x0000000000000000) at gdkeventsource.c:367:7 frame #28: 0x00000008016e92e9 libglib-2.0.so.0`g_main_dispatch(context=0x000000080343b300) at gmain.c:3325:27 frame #29: 0x00000008016e9120 libglib-2.0.so.0`g_main_context_dispatch(context=0x000000080343b300) at gmain.c:4016:7 frame #30: 0x00000008016e9682 libglib-2.0.so.0`g_main_context_iterate(context=0x000000080343b300, block=1, dispatch=1, self=0x000000080355d8f0) at gmain.c:4092:5 frame #31: 0x00000008016e9bc8 libglib-2.0.so.0`g_main_loop_run(loop=0x000000080591bd00) at gmain.c:4290:5 frame #32: 0x0000000800ea9bcc libgtk-3.so.0`gtk_main at gtkmain.c:1328:7 frame #33: 0x00000008003ac453 libgeany.so.0`main_lib(argc=1, argv=0x00007fffffffe8a8) at libmain.c:1259:2 frame #34: 0x00000000002019f2 geany`main(argc=2, argv=0x00007fffffffe8a8) at main.c:27:9 frame #35: 0x00000000002017df geany`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7 (lldb) f 0 frame #0: 0x0000000800401793 libgeany.so.0`vte_start(widget=0x00000008054e5b50) at vte.c:497:38 494 495 if (vf->vte_terminal_spawn_sync) 496 { -> 497 if (! vf->vte_terminal_spawn_sync(VTE_TERMINAL(widget), VTE_PTY_DEFAULT, 498 vte_info.dir, argv, env, 0, NULL, NULL, 499 &pid, NULL, NULL)) 500 { (In reply to Guido Falsi from comment #1) > Are you building ports with poudriere or directly on the live system? No, I installed it with the'pkg install' command. (In reply to Barbara Guida from comment #2) Your comments are very helpful. I found a related issue. Segmentation fault with vte while quitting https://github.com/geany/geany/issues/2457 Thank you. (In reply to Hodong from comment #4) Thanks for pointing me to this issue, I need to study that issue and the source code a little more and I could send a patch for the port here for testing. Please give me some days to find time to properly do this and perform my own testing. Will you be able to test it? It will require recompiling geany. Guido, I can help you building and testing the port if needed. In the meanwhile I can test the patch from openSUSE. Created attachment 218929 [details] patch from openSUSE - https://build.opensuse.org/request/show/798371 (geany-avoid-segfault-on-quit.patch) I've tested the patch and it works; geany isn't crashing anymore on close. I don't know if you want to find a more elegant solution, anyway I'm attaching the diff I've used. I've also changed VTE_USE to GNOME=vte3 because, as I've reported on comment #2, file from x11-toolkits/vte3 are being loaded and geany is the last and only port I have installed depending on x11-toolkits/vte, so I've removed it before start building. ***Maybe*** the VTE_USE should be moved inside the test for FLAVOR (GNOME=vte for gtk2 and GNOME=vte3 for gtk) as it seems to me that x11-toolkits/vte is tied to x11-toolkits/gtk20 while x11-toolkits/vte3 to x11-toolkits/gtk30, isn't it? (In reply to Barbara Guida from comment #8) Thanks for the patch. I'm going to test it. The VTE dependency definitely needs fixing. I'm going to do that too. Created attachment 218994 [details]
Use g_signal_handlers_disconnect_by_func()
After gtk_widget_destroy(), "child-exited" signal was emitted.
So, use g_signal_handlers_disconnect_by_func(vc->vte, G_CALLBACK(vte_start), NULL); before gtk_widget_destroy().
--- a/src/vte.c
+++ b/src/vte.c
@@ -399,6 +399,7 @@ void vte_close(void)
g_free(vf);
/* free the vte widget before unloading vte module
* this prevents a segfault on X close window if the message window is hidden */
+ g_signal_handlers_disconnect_by_func(vc->vte, G_CALLBACK(vte_start), NULL);
gtk_widget_destroy(vc->vte);
gtk_widget_destroy(vc->menu);
g_object_unref(vc->menu);
I don't have a GitHub account. If you wish, you can submit it to the Geany project. (In reply to Hodong from comment #11) This patch is interesting, yes. I'm going to test it. I have a lot of things in testing so it takes me a little time. I'll try to upstream it too if it works fine. (In reply to Hodong from comment #11) Created a pull request upstream: https://github.com/geany/geany/pull/2634 I'm going to commit the patch to the ports tree shortly. A commit references this bug: Author: madpilot Date: Sat Oct 24 08:52:00 UTC 2020 New revision: 553166 URL: https://svnweb.freebsd.org/changeset/ports/553166 Log: Fix crash on close due to a signal handler on VTE widget being fired after the widget is destroyed. PR: 250403 Submitted by: Hodong <hodong@nimfsoft.com> MFH: 2020Q4 Changes: head/devel/geany/Makefile head/devel/geany/files/ head/devel/geany/files/patch-src_vte.c A commit references this bug: Author: madpilot Date: Sat Oct 24 10:42:05 UTC 2020 New revision: 553178 URL: https://svnweb.freebsd.org/changeset/ports/553178 Log: MFH: r553166 Fix crash on close due to a signal handler on VTE widget being fired after the widget is destroyed. PR: 250403 Submitted by: Hodong <hodong@nimfsoft.com> Approved by: ports-secteam (joneum) Changes: _U branches/2020Q4/ branches/2020Q4/devel/geany/Makefile branches/2020Q4/devel/geany/files/ Patch committed and merged. Thanks! BTW upstream has already acknowledged the patch and is evaluating it. |