core dumping in wx / GTK on linux

Hi all,

I’m seeing core dumps in a wx 2.9.4.1 app running on linux (on both 32 and 64 bit installations). From the backtraces it seems it’s related to wx and GTK. I’ve tried to investigate by running the app via gdb (gdb --args python wxFoo.py) and with winpdb to no avail. The stacks are 50+ levels deep, so I’ll attach a snippet here that shows some of the wx and GTK related calls. I’m pretty new to python and wx, so any tips or advice would be greatly appreciated!

Program received signal SIGSEGV, Segmentation fault.

IA__gtk_text_layout_draw (layout=0x8cf05c0 [GtkTextLayout], widget=widget@entry=0x8d51008 [GtkTextView], drawable=0x934caf0 [GdkWindow], cursor_gc=cursor_gc@entry=0x0, x_offset=0, y_offset=0, x=0, y=140, width=

1387, height=491, widgets=widgets@entry=0xbfffdb58) at gtktextdisplay.c:867

867 if (cursor->is_strong)

(gdb) bt

#0 IA__gtk_text_layout_draw (layout=0x8cf05c0 [GtkTextLayout], widget=widget@entry=0x8d51008 [GtkTextView], drawable=0x934caf0 [GdkWindow], cursor_gc=cursor_gc@entry=0x0, x_offset=0, y_offset=0, x=0, y=140,

width=1387, height=491, widgets=widgets@entry=0xbfffdb58) at gtktextdisplay.c:867

#1 0x498e9020 in gtk_text_view_paint (event=0xbfffe068, area=0xbfffe074, widget=0x8d51008 [GtkTextView]) at gtktextview.c:4621

#2 gtk_text_view_expose_event (widget=widget@entry=0x8d51008 [GtkTextView], event=0xbfffe068) at gtktextview.c:4657

#3 0x497feee2 in _gtk_marshal_BOOLEAN__BOXED (closure=0x8ca4520, return_value=0xbfffdcf0, n_param_values=2, param_values=0xbfffdd60, invocation_hint=0xbfffdd0c, marshal_data=

0x498e8eb0 <gtk_text_view_expose_event>) at gtkmarshalers.c:86

#4 0xb6b82e3e in g_type_class_meta_marshal (closure=closure@entry=0x8ca4520, return_value=return_value@entry=0xbfffdcf0, n_param_values=n_param_values@entry=2, param_values=param_values@entry=0xbfffdd60,

invocation_hint=invocation_hint@entry=0xbfffdd0c, marshal_data=marshal_data@entry=0xc8) at gclosure.c:970

#5 0xb6b84007 in g_closure_invoke (closure=closure@entry=0x8ca4520, return_value=return_value@entry=0xbfffdcf0, n_param_values=2, param_values=param_values@entry=0xbfffdd60,

invocation_hint=invocation_hint@entry=0xbfffdd0c) at gclosure.c:777

#6 0xb6b95c58 in signal_emit_unlocked_R (node=node@entry=0x8ca4548, detail=detail@entry=0, instance=instance@entry=0x8d51008, emission_return=emission_return@entry=0xbfffde3c,

instance_and_params=instance_and_params@entry=0xbfffdd60) at gsignal.c:3589

#7 0xb6b9dfce in g_signal_emit_valist (instance=instance@entry=0x8d51008, signal_id=signal_id@entry=41, detail=detail@entry=0, var_args=0xbfffdf80 “\254\337\377\277h\340\377\277”, var_args@entry=

0xbfffdf7c “h\340\377\277\254\337\377\277h\340\377\277”) at gsignal.c:3310

#8 0xb6b9e3e4 in g_signal_emit (instance=instance@entry=0x8d51008, signal_id=41, detail=detail@entry=0) at gsignal.c:3356

#9 0x49954d73 in gtk_widget_event_internal (widget=widget@entry=0x8d51008 [GtkTextView], event=event@entry=0xbfffe068) at gtkwidget.c:5017

#10 0x49955001 in IA__gtk_widget_send_expose (widget=widget@entry=0x8d51008 [GtkTextView], event=event@entry=0xbfffe068) at gtkwidget.c:4846

#11 0x497fd047 in IA__gtk_main_do_event (event=0xbfffe068) at gtkmain.c:1610

#12 0x49c02ba0 in _gdk_window_process_updates_recurse (window=window@entry=0x934caf0 [GdkWindow], expose_region=expose_region@entry=0x934d280) at gdkwindow.c:5429

#13 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x934ca40 [GdkWindow], expose_region=expose_region@entry=0x8cce0a0) at gdkwindow.c:5402

#14 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x934c990 [GdkWindow], expose_region=expose_region@entry=0x8d50ae0) at gdkwindow.c:5402

#15 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89f18 [GdkWindow], expose_region=expose_region@entry=0x8cf6440) at gdkwindow.c:5402

#16 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89e68 [GdkWindow], expose_region=expose_region@entry=0x8d50b80) at gdkwindow.c:5402

#17 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89998 [GdkWindow], expose_region=expose_region@entry=0xb32a61c0) at gdkwindow.c:5402

#18 0x49c3f1c4 in _gdk_windowing_window_process_updates_recurse (window=window@entry=0x8d89998 [GdkWindow], region=region@entry=0xb32a61c0) at gdkwindow-x11.c:5643

#19 0x49bfd172 in gdk_window_process_updates_internal (window=) at gdkwindow.c:5588

#20 0x49bff73f in IA__gdk_window_process_all_updates () at gdkwindow.c:5696

#21 0x497611e1 in gtk_container_idle_sizer (data=0x0) at gtkcontainer.c:1360

#22 0x49bd8b4c in gdk_threads_dispatch (data=data@entry=0x9360920) at gdk.c:512

#23 0xb6a90311 in g_idle_dispatch (source=source@entry=0xb32a5ba8, callback=0x49bd8af0 <gdk_threads_dispatch>, user_data=0x9360920) at gmain.c:4806

#24 0xb6a9315b in g_main_dispatch (context=0x87e2dd8, context@entry=0x8d71250) at gmain.c:2715

#25 g_main_context_dispatch (context=context@entry=0x87e2dd8) at gmain.c:3219

#26 0xb6a93500 in g_main_context_iterate (context=0x87e2dd8, block=block@entry=1, dispatch=dispatch@entry=1, self=) at gmain.c:3290

#27 0xb6a93963 in g_main_loop_run (loop=loop@entry=0x92dd9e0) at gmain.c:3484

#28 0x497fba40 in IA__gtk_main () at gtkmain.c:1257

#29 0xb70bf12b in wxGUIEventLoop::Run (this=0x92d9aa8) at /home/remlab/builds/wxPython-src-2.9.4.0/src/gtk/evtloop.cpp:60

#30 0xb6d914cd in wxAppConsoleBase::MainLoop (this=0x87c7398) at /home/remlab/builds/wxPython-src-2.9.4.0/src/common/appbase.cpp:314

#31 0xb78bdc77 in wxPyApp::MainLoop (this=0x87c7398) at src/helpers.cpp:215

···

Gtk:ERROR:/build/buildd/gtk+2.0-2.24.10/gtk/gtktextlayout.c:2349:IA__gtk_text_layout_get_line_display: code should not be reached

/bin/bash: line 1: 2699 Aborted (core dumped) /usr/bin/python “/usr/lib/pymodules/python2.7/rpdb2.py” --debugee --chdir --rid=7446342 “/mnt/ydrive/gen3_matchbox/bin/wxFast.py”


(wxFast.py:23312): Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created.

You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.

You can apply tags and insert marks without invalidating your iterators,

but any mutation that affects ‘indexable’ buffer contents (contents that can be referred to by character offset)

will invalidate all outstanding iterators

(wxFast.py:23312): Pango-CRITICAL **: pango_layout_get_iter: assertion `PANGO_IS_LAYOUT (layout)’ failed

Program received signal SIGSEGV, Segmentation fault.

0x017263b6 in pango_layout_index_to_pos () from /usr/lib/i386-linux-gnu/libpango-1.0.so.0


(wxFast.py:26851): Gtk-ERROR **: Unknown segment type:

Program received signal SIGTRAP, Trace/breakpoint trap.

g_logv (log_domain=log_domain@entry=0x499edadb “Gtk”, log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x49a9c26f “Unknown segment type: %s”, args=args@entry=0xbfffe1cc " Y>\t0(5\tP")

at gmessages.c:974

974 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));

Hi Patrick,
less than three years later, I’ve found the same issue with wxPython here. The GUI lives for a while, after an unpredictable amount of accesses to a wxTextCtrl, the program stops with Gtk error msg. as you described.
did you succeed in finding a root cause for this issue ?

Andreas

···

Am Dienstag, 5. Februar 2013 20:25:04 UTC+1 schrieb patrick korsnick:

Hi all,

I’m seeing core dumps in a wx 2.9.4.1 app running on linux (on both 32 and 64 bit installations). From the backtraces it seems it’s related to wx and GTK. I’ve tried to investigate by running the app via gdb (gdb --args python wxFoo.py) and with winpdb to no avail. The stacks are 50+ levels deep, so I’ll attach a snippet here that shows some of the wx and GTK related calls. I’m pretty new to python and wx, so any tips or advice would be greatly appreciated!

Program received signal SIGSEGV, Segmentation fault.

IA__gtk_text_layout_draw (layout=0x8cf05c0 [GtkTextLayout], widget=widget@entry=0x8d51008 [GtkTextView], drawable=0x934caf0 [GdkWindow], cursor_gc=cursor_gc@entry=0x0, x_offset=0, y_offset=0, x=0, y=140, width=

1387, height=491, widgets=widgets@entry=0xbfffdb58) at gtktextdisplay.c:867

867 if (cursor->is_strong)

(gdb) bt

#0 IA__gtk_text_layout_draw (layout=0x8cf05c0 [GtkTextLayout], widget=widget@entry=0x8d51008 [GtkTextView], drawable=0x934caf0 [GdkWindow], cursor_gc=cursor_gc@entry=0x0, x_offset=0, y_offset=0, x=0, y=140,

width=1387, height=491, widgets=widgets@entry=0xbfffdb58) at gtktextdisplay.c:867

#1 0x498e9020 in gtk_text_view_paint (event=0xbfffe068, area=0xbfffe074, widget=0x8d51008 [GtkTextView]) at gtktextview.c:4621

#2 gtk_text_view_expose_event (widget=widget@entry=0x8d51008 [GtkTextView], event=0xbfffe068) at gtktextview.c:4657

#3 0x497feee2 in _gtk_marshal_BOOLEAN__BOXED (closure=0x8ca4520, return_value=0xbfffdcf0, n_param_values=2, param_values=0xbfffdd60, invocation_hint=0xbfffdd0c, marshal_data=

0x498e8eb0 <gtk_text_view_expose_event>) at gtkmarshalers.c:86

#4 0xb6b82e3e in g_type_class_meta_marshal (closure=closure@entry=0x8ca4520, return_value=return_value@entry=0xbfffdcf0, n_param_values=n_param_values@entry=2, param_values=param_values@entry=0xbfffdd60,

invocation_hint=invocation_hint@entry=0xbfffdd0c, marshal_data=marshal_data@entry=0xc8) at gclosure.c:970

#5 0xb6b84007 in g_closure_invoke (closure=closure@entry=0x8ca4520, return_value=return_value@entry=0xbfffdcf0, n_param_values=2, param_values=param_values@entry=0xbfffdd60,

invocation_hint=invocation_hint@entry=0xbfffdd0c) at gclosure.c:777

#6 0xb6b95c58 in signal_emit_unlocked_R (node=node@entry=0x8ca4548, detail=detail@entry=0, instance=instance@entry=0x8d51008, emission_return=emission_return@entry=0xbfffde3c,

instance_and_params=instance_and_params@entry=0xbfffdd60) at gsignal.c:3589

#7 0xb6b9dfce in g_signal_emit_valist (instance=instance@entry=0x8d51008, signal_id=signal_id@entry=41, detail=detail@entry=0, var_args=0xbfffdf80 “\254\337\377\277h\340\377\277”, var_args@entry=

0xbfffdf7c “h\340\377\277\254\337\377\277h\340\377\277”) at gsignal.c:3310

#8 0xb6b9e3e4 in g_signal_emit (instance=instance@entry=0x8d51008, signal_id=41, detail=detail@entry=0) at gsignal.c:3356

#9 0x49954d73 in gtk_widget_event_internal (widget=widget@entry=0x8d51008 [GtkTextView], event=event@entry=0xbfffe068) at gtkwidget.c:5017

#10 0x49955001 in IA__gtk_widget_send_expose (widget=widget@entry=0x8d51008 [GtkTextView], event=event@entry=0xbfffe068) at gtkwidget.c:4846

#11 0x497fd047 in IA__gtk_main_do_event (event=0xbfffe068) at gtkmain.c:1610

#12 0x49c02ba0 in _gdk_window_process_updates_recurse (window=window@entry=0x934caf0 [GdkWindow], expose_region=expose_region@entry=0x934d280) at gdkwindow.c:5429

#13 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x934ca40 [GdkWindow], expose_region=expose_region@entry=0x8cce0a0) at gdkwindow.c:5402

#14 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x934c990 [GdkWindow], expose_region=expose_region@entry=0x8d50ae0) at gdkwindow.c:5402

#15 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89f18 [GdkWindow], expose_region=expose_region@entry=0x8cf6440) at gdkwindow.c:5402

#16 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89e68 [GdkWindow], expose_region=expose_region@entry=0x8d50b80) at gdkwindow.c:5402

#17 0x49c02bf3 in _gdk_window_process_updates_recurse (window=window@entry=0x8d89998 [GdkWindow], expose_region=expose_region@entry=0xb32a61c0) at gdkwindow.c:5402

#18 0x49c3f1c4 in _gdk_windowing_window_process_updates_recurse (window=window@entry=0x8d89998 [GdkWindow], region=region@entry=0xb32a61c0) at gdkwindow-x11.c:5643

#19 0x49bfd172 in gdk_window_process_updates_internal (window=) at gdkwindow.c:5588

#20 0x49bff73f in IA__gdk_window_process_all_updates () at gdkwindow.c:5696

#21 0x497611e1 in gtk_container_idle_sizer (data=0x0) at gtkcontainer.c:1360

#22 0x49bd8b4c in gdk_threads_dispatch (data=data@entry=0x9360920) at gdk.c:512

#23 0xb6a90311 in g_idle_dispatch (source=source@entry=0xb32a5ba8, callback=0x49bd8af0 <gdk_threads_dispatch>, user_data=0x9360920) at gmain.c:4806

#24 0xb6a9315b in g_main_dispatch (context=0x87e2dd8, context@entry=0x8d71250) at gmain.c:2715

#25 g_main_context_dispatch (context=context@entry=0x87e2dd8) at gmain.c:3219

#26 0xb6a93500 in g_main_context_iterate (context=0x87e2dd8, block=block@entry=1, dispatch=dispatch@entry=1, self=) at gmain.c:3290

#27 0xb6a93963 in g_main_loop_run (loop=loop@entry=0x92dd9e0) at gmain.c:3484

#28 0x497fba40 in IA__gtk_main () at gtkmain.c:1257

#29 0xb70bf12b in wxGUIEventLoop::Run (this=0x92d9aa8) at /home/remlab/builds/wxPython-src-2.9.4.0/src/gtk/evtloop.cpp:60

#30 0xb6d914cd in wxAppConsoleBase::MainLoop (this=0x87c7398) at /home/remlab/builds/wxPython-src-2.9.4.0/src/common/appbase.cpp:314

#31 0xb78bdc77 in wxPyApp::MainLoop (this=0x87c7398) at src/helpers.cpp:215


Gtk:ERROR:/build/buildd/gtk+2.0-2.24.10/gtk/gtktextlayout.c:2349:IA__gtk_text_layout_get_line_display: code should not be reached

/bin/bash: line 1: 2699 Aborted (core dumped) /usr/bin/python “/usr/lib/pymodules/python2.7/rpdb2.py” --debugee --chdir --rid=7446342 “/mnt/ydrive/gen3_matchbox/bin/wxFast.py”


(wxFast.py:23312): Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created.

You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.

You can apply tags and insert marks without invalidating your iterators,

but any mutation that affects ‘indexable’ buffer contents (contents that can be referred to by character offset)

will invalidate all outstanding iterators

(wxFast.py:23312): Pango-CRITICAL **: pango_layout_get_iter: assertion `PANGO_IS_LAYOUT (layout)’ failed

Program received signal SIGSEGV, Segmentation fault.

0x017263b6 in pango_layout_index_to_pos () from /usr/lib/i386-linux-gnu/libpango-1.0.so.0


(wxFast.py:26851): Gtk-ERROR **: Unknown segment type:

Program received signal SIGTRAP, Trace/breakpoint trap.

g_logv (log_domain=log_domain@entry=0x499edadb “Gtk”, log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x49a9c26f “Unknown segment type: %s”, args=args@entry=0xbfffe1cc " Y>\t0(5\tP")

at gmessages.c:974

974 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));