我正在GTK中制作IRC应用程序。该应用程序运行很长一段时间。然后它将随机段错误。无论我是否与应用程序进行交互,都会发生这种情况。它似乎也独立于应用程序正在进行的操作而发生。它似乎是一个导致segfault的随机信号。我认为情况就是这样,因为g_signal_emit_valist位于回溯的顶端。
我安装了调试符号并捕获了回溯。这真的很难追查,因为它似乎是GTK在后台做的事情。它随机发生,用户根本不需要与应用程序进行交互:
[_LOG_LEVEL_FATAL 23:35:03.911654] [Gtk] gtk_container_get_path_for_child: assertion 'container == (GtkContainer *) gtk_widget_get_parent (child)' failed
[_LOG_LEVEL_FATAL 23:35:03.911685] Relay will not function properly.
[_LOG_LEVEL_FATAL 23:35:03.911711] [Gtk] gtk_widget_path_length: assertion 'path != NULL' failed
[_LOG_LEVEL_FATAL 23:35:03.911727] Relay will not function properly.
[_LOG_LEVEL_FATAL 23:35:03.911751] [Gtk] gtk_widget_path_length: assertion 'path != NULL' failed
[_LOG_LEVEL_FATAL 23:35:03.911765] Relay will not function properly.
[_LOG_LEVEL_FATAL 23:35:03.911787] [Gtk] _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
[_LOG_LEVEL_FATAL 23:35:03.911802] Relay will not function properly.
[_LOG_LEVEL_FATAL 23:35:03.911822] [Gtk] gtk_widget_path_free: assertion 'path != NULL' failed
[_LOG_LEVEL_FATAL 23:35:03.911837] Relay will not function properly.
[_LOG_LEVEL_FATAL 23:35:03.911857] [Gtk] _gtk_css_array_value_get_n_values: assertion 'value != NULL' failed
[_LOG_LEVEL_FATAL 23:35:03.911872] Relay will not function properly.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff68511d5 in _gtk_css_computed_values_get_difference (values=values@entry=0x11ecd80, other=other@entry=0x7e1360) at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkcsscomputedvalues.c:265
265 /build/buildd/gtk+3.0-3.14.13/./gtk/gtkcsscomputedvalues.c: No such file or directory.
(gdb) bt
#0 0x00007ffff68511d5 in _gtk_css_computed_values_get_difference (values=values@entry=0x11ecd80, other=other@entry=0x7e1360) at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkcsscomputedvalues.c:265
#1 0x00007ffff69844dd in _gtk_style_context_validate (context=0xde7140, timestamp=timestamp@entry=42210631858, change=2056, change@entry=GTK_CSS_CHANGE_PARENT_STATE, parent_changes=parent_changes@entry=0x152d200)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3077
#2 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=GTK_CSS_CHANGE_PARENT_STATE, change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#3 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#4 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#5 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
---Type <return> to continue, or q <return> to quit---
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#6 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#7 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#8 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#9 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#10 0x00007ffff69843d2 in _gtk_style_context_validate (context=<optimized out>, timestamp=timestamp@entry=42210631858, change=change@entry=0, parent_changes=parent_changes@entry=0x1)
---Type <return> to continue, or q <return> to quit---
at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkstylecontext.c:3115
#11 0x00007ffff684b5ba in gtk_container_idle_sizer (clock=0x6b2200, container=0x884230) at /build/buildd/gtk+3.0-3.14.13/./gtk/gtkcontainer.c:1738
#12 0x00007ffff5c563f7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007ffff5c6e728 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007ffff5c6f8a2 in g_signal_emit_by_name () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff6486642 in gdk_frame_clock_paint_idle (data=0x6b2200) at /build/buildd/gtk+3.0-3.14.13/./gdk/gdkframeclockidle.c:408
#16 0x00007ffff6478e08 in gdk_threads_dispatch (data=0x12fa640) at /build/buildd/gtk+3.0-3.14.13/./gdk/gdk.c:656
#17 0x00007ffff59834d3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff5982ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff5982e18 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
这是一个回溯:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6870a85 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
(gdb) bt
#0 0x00007ffff6870a85 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#1 0x00007ffff6851240 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#2 0x00007ffff69844dd in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#3 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#4 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#5 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#7 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#8 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007ffff684b5ba in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff5c563f7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff5c6e728 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff5c6f8a2 in g_signal_emit_by_name () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007ffff6486642 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#18 0x00007ffff6478e08 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#19 0x00007ffff59834d3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff5982ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007ffff5982e18 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007ffff59830da in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff68f2675 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#24 0x00000000004335b2 in relay_real_activate (base=0x656200) at /home/kyle/Apps/projects/relay/src/relay.c:158
#25 0x00007ffff5c563f7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff5c6e728 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff5c6f372 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#28 0x00007ffff61871df in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#29 0x00007ffff618737b in g_application_run () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#30 0x00007ffff753e0c0 in granite_application_run () from /usr/lib/x86_64-linux-gnu/libgranite.so.2
#31 0x0000000000433461 in relay_main (args=0x7fffffffe088, args_length1=2) at /home/kyle/Apps/projects/relay/src/relay.c:123
#32 0x000000000043349e in main (argc=2, argv=0x7fffffffe088) at /home/kyle/Apps/projects/relay/src/relay.c:132
这是另一个在segfaults之前的日志中有一个奇怪的CSS错误。我没有用CSS做任何事情:
[_LOG_LEVEL_FATAL 13:22:40.458929] [Gtk] _gtk_css_array_value_get_n_values: assertion 'value != NULL' failed
[_LOG_LEVEL_FATAL 13:22:40.458954] Relay will not function properly.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff68511d5 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
(gdb) bt
#0 0x00007ffff68511d5 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#1 0x00007ffff69844dd in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#2 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#3 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#4 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#5 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#7 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#8 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007ffff69843d2 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff684b5ba in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007ffff5c563f7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007ffff5c6e728 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff5c6f8a2 in g_signal_emit_by_name () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007ffff6486642 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#16 0x00007ffff6478e08 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#17 0x00007ffff59834d3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff5982ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff5982e18 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff59830da in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007ffff68f2675 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#22 0x00000000004334a7 in relay_real_activate (base=0x656200) at /home/kyle/Apps/projects/relay/src/relay.c:158
#23 0x00007ffff5c563f7 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff5c6e728 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff5c6f372 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff61871df in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#27 0x00007ffff618737b in g_application_run () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#28 0x00007ffff753e0c0 in granite_application_run () from /usr/lib/x86_64-linux-gnu/libgranite.so.2
#29 0x000000000043335d in relay_main (args=0x7fffffffe088, args_length1=2) at /home/kyle/Apps/projects/relay/src/relay.c:123
#30 0x000000000043339a in main (argc=2, argv=0x7fffffffe088) at /home/kyle/Apps/projects/relay/src/relay.c:132
答案 0 :(得分:0)
事实证明这是因为我在主UI线程中调用了一个信号。一旦我把Idle()包裹起来,问题就消失了。