Hi, I'm writing a multi-threaded script with wxPython as a GUI toolkit. About 50% of the time, I can run my script flawlessly. The other 50% of the time, I get huge errors regarding wxPython that I cannot seem to decipher; however, I think it could possibly be a problem with one of my lists? I'm not sure what information I post will be helpful, so just request whatever else you feel would be necessary in fixing this error. I will try to respond as promptly as I can.

OS: Ubuntu 9.10 64 bit
Python Version: 2.6

I guess I should probably start by simply posting the error. Here you go.

*** glibc detected *** python: corrupted double-linked list: 0x0000000001568f30 ***
======= Backtrace: =========
/lib/libc.so.6[0x7f16c76b2dd6]
/lib/libc.so.6[0x7f16c76b6452]
/lib/libc.so.6(__libc_malloc+0x6e)[0x7f16c76b782e]
/usr/lib/libfontconfig.so.1[0x7f16c3e12a4a]
/usr/lib/libfontconfig.so.1[0x7f16c3e12aeb]
/usr/lib/libfontconfig.so.1[0x7f16c3e12aeb]
/usr/lib/libfontconfig.so.1[0x7f16c3e12aeb]
/usr/lib/libfontconfig.so.1(FcConfigSubstituteWithPat+0x245)[0x7f16c3e12eb5]
/usr/lib/libpangocairo-1.0.so.0[0x7f16c2616400]
/usr/lib/libpangoft2-1.0.so.0[0x7f16c49dad7b]
/usr/lib/libpango-1.0.so.0[0x7f16c42d9113]
/usr/lib/libpango-1.0.so.0(pango_itemize_with_base_dir+0x70)[0x7f16c42d9790]
/usr/lib/libpango-1.0.so.0[0x7f16c42e1598]
/usr/lib/libpango-1.0.so.0[0x7f16c42e28fc]
/usr/lib/libgtk-x11-2.0.so.0(gtk_text_layout_get_line_display+0x616)[0x7f16c52a8b16]
/usr/lib/libgtk-x11-2.0.so.0(gtk_text_layout_get_iter_location+0xf8)[0x7f16c52aa948]
/usr/lib/libgtk-x11-2.0.so.0(gtk_text_view_scroll_to_iter+0x130)[0x7f16c52b79e0]
/usr/lib/libgtk-x11-2.0.so.0[0x7f16c52b7cb5]
/usr/lib/libgtk-x11-2.0.so.0[0x7f16c52b7d19]
/usr/lib/libgtk-x11-2.0.so.0[0x7f16c52b7d69]
/usr/lib/libgdk-x11-2.0.so.0[0x7f16c4e368c6]
/lib/libglib-2.0.so.0(g_main_context_dispatch+0x22e)[0x7f16c3325bce]
/lib/libglib-2.0.so.0[0x7f16c3329598]
/lib/libglib-2.0.so.0(g_main_loop_run+0x1a5)[0x7f16c33299f5]
/usr/lib/libgtk-x11-2.0.so.0(gtk_main+0xa7)[0x7f16c51ff177]
/usr/lib/libwx_gtk2u_core-2.6.so.0(_ZN11wxEventLoop3RunEv+0x53)[0x7f16c64dbc03]
/usr/lib/libwx_gtk2u_core-2.6.so.0(_ZN9wxAppBase8MainLoopEv+0x4b)[0x7f16c65581bb]
/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode/wx/_core_.so(_ZN7wxPyApp8MainLoopEv+0x37)[0x7f16c72d73d7]
/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode/wx/_core_.so[0x7f16c72f4d77]
python(PyEval_EvalFrameEx+0x4c89)[0x4a2299]
python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
python[0x52be30]
python(PyObject_Call+0x47)[0x41d6e7]
python[0x4254ff]
python(PyObject_Call+0x47)[0x41d6e7]
python(PyEval_EvalFrameEx+0x438c)[0x4a199c]
python(PyEval_EvalFrameEx+0x5837)[0x4a2e47]
python(PyEval_EvalFrameEx+0x5837)[0x4a2e47]
python(PyEval_EvalFrameEx+0x5837)[0x4a2e47]
python(PyEval_EvalCodeEx+0x860)[0x4a40e0]
python[0x52be30]
python(PyObject_Call+0x47)[0x41d6e7]
python[0x4254ff]
python(PyObject_Call+0x47)[0x41d6e7]
python(PyEval_CallObjectWithKeywords+0x43)[0x49c623]
python[0x4d0bed]
/lib/libpthread.so.0[0x7f16c8254a04]
/lib/libc.so.6(clone+0x6d)[0x7f16c771c80d]
======= Memory map: ========
00400000-0060f000 r-xp 00000000 08:01 3875 /usr/bin/python2.6
0080e000-0080f000 r--p 0020e000 08:01 3875 /usr/bin/python2.6
0080f000-00870000 rw-p 0020f000 08:01 3875 /usr/bin/python2.6
00870000-0087e000 rw-p 00000000 00:00 0
014ba000-02018000 rw-p 00000000 00:00 0 [heap]
7f16b4000000-7f16b4021000 rw-p 00000000 00:00 0
7f16b4021000-7f16b8000000 ---p 00000000 00:00 0
7f16ba22d000-7f16ba22e000 ---p 00000000 00:00 0
7f16ba22e000-7f16baa2e000 rw-p 00000000 00:00 0
7f16baa2e000-7f16baa2f000 ---p 00000000 00:00 0
7f16baa2f000-7f16bb22f000 rw-p 00000000 00:00 0
7f16bb22f000-7f16bb23a000 r-xp 00000000 08:01 7401 /lib/libudev.so.0.5.0
7f16bb23a000-7f16bb43a000 ---p 0000b000 08:01 7401 /lib/libudev.so.0.5.0
7f16bb43a000-7f16bb43b000 r--p 0000b000 08:01 7401 /lib/libudev.so.0.5.0
7f16bb43b000-7f16bb43c000 rw-p 0000c000 08:01 7401 /lib/libudev.so.0.5.0
7f16bb43c000-7f16bb465000 r-xp 00000000 08:01 1049167 /usr/lib/gio/modules/libgvfsdbus.so
7f16bb465000-7f16bb664000 ---p 00029000 08:01 1049167 /usr/lib/gio/modules/libgvfsdbus.so
7f16bb664000-7f16bb665000 r--p 00028000 08:01 1049167 /usr/lib/gio/modules/libgvfsdbus.so
7f16bb665000-7f16bb666000 rw-p 00029000 08:01 1049167 /usr/lib/gio/modules/libgvfsdbus.so
7f16bb666000-7f16bb67d000 r-xp 00000000 08:01 2970 /usr/lib/libgvfscommon.so.0.0.0
7f16bb67d000-7f16bb87c000 ---p 00017000 08:01 2970 /usr/lib/libgvfscommon.so.0.0.0
7f16bb87c000-7f16bb87d000 r--p 00016000 08:01 2970 /usr/lib/libgvfscommon.so.0.0.0
7f16bb87d000-7f16bb87e000 rw-p 00017000 08:01 2970 /usr/lib/libgvfscommon.so.0.0.0
7f16bb87e000-7f16bb891000 r-xp 00000000 08:01 1049166 /usr/lib/gio/modules/libgioremote-volume-monitor.so
7f16bb891000-7f16bba90000 ---p 00013000 08:01 1049166 /usr/lib/gio/modules/libgioremote-volume-monitor.so
7f16bba90000-7f16bba91000 r--p 00012000 08:01 1049166 /usr/lib/gio/modules/libgioremote-volume-monitor.so
7f16bba91000-7f16bba92000 rw-p 00013000 08:01 1049166 /usr/lib/gio/modules/libgioremote-volume-monitor.so
7f16bbe61000-7f16bbec1000 rw-s 00000000 00:09 42827794 /SYSV00000000 (deleted)
7f16bbec1000-7f16bbec5000 r-xp 00000000 08:01 1189002 /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
7f16bbec5000-7f16bc0c5000 ---p 00004000 08:01 1189002 /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
7f16bc0c5000-7f16bc0c6000 r--p 00004000 08:01 1189002 /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
7f16bc0c6000-7f16bc0c7000 rw-p 00005000 08:01 1189002 /usr/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so
7f16bc0c7000-7f16bc0c9000 r-xp 00000000 08:01 787061 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
7f16bc0c9000-7f16bc2c8000 ---p 00002000 08:01 787061 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
7f16bc2c8000-7f16bc2c9000 r--p 00001000 08:01 787061 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
7f16bc2c9000-7f16bc2ca000 rw-p 00002000 08:01 787061 /usr/lib/pango/1.6.0/modules/pango-basic-fc.so
7f16bc2ca000-7f16bc362000 r--p 00000000 08:01 919813 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
7f16bc362000-7f16bc39f000 r-xp 00000000 08:01 558 /lib/libdbus-1.so.3.4.0
7f16bc39f000-7f16bc59f000 ---p 0003d000 08:01 558 /lib/libdbus-1.so.3.4.0
7f16bc59f000-7f16bc5a0000 r--p 0003d000 08:01 558 /lib/libdbus-1.so.3.4.0
7f16bc5a0000-7f16bc5a1000 rw-p 0003e000 08:01 558 /lib/libdbus-1.so.3.4.0
7f16bc5a1000-7f16bc5de000 r-xp 00000000 08:01 3947 /usr/lib/libibus.so.1.0.0
7f16bc5de000-7f16bc7dd000 ---p 0003d000 08:01 3947 /usr/lib/libibus.so.1.0.0
7f16bc7dd000-7f16bc7df000 r--p 0003c000 08:01 3947 /usr/lib/libibus.so.1.0.0
7f16bc7df000-7f16bc7e0000 rw-p 0003e000 08:01 3947 /usr/lib/libibus.so.1.0.0
7f16bc7e0000-7f16bc7e1000 rw-p 00000000 00:00 0
7f16bc7e1000-7f16bc7e6000 r-xp 00000000 08:01 1180252 /usr/lib/gtk-2.0/2.10.0/immodules/im-ibus.soAborted

Any ideas on what I can do?

Thanks very much in advance.

I don't know what you are doing but in C++ version you should write no GUI functionality on secondary thread. All GUI issues should Go to primary one and others to secondary.

Sorry, I'm just having a little bit of trouble understanding what you are trying to say. Do you want me to have two threads running, and have one with a GUI and one without?

Let me try to explain my script a little further. The way I'm doing it right now, I only have two threads; thread one solely takes care of the "main loop" of the GUI, and the second thread wakes up every 100 milliseconds and checks the values of various variables in the script. If the values are as expected, it causes the GUI to change in some way.

Any other ideas on what could be causing this?

Thanks again.

I have a little bit of an update. I took my GUI "mainloop" out of a separate thread in hope I would get a more descriptive error message, which I did. Here are the two I get most frequently:

(python:2641): 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

Segmentation fault

(python:2520): Gtk-CRITICAL **: gtk_text_layout_real_invalidate: assertion `layout->wrap_loop_count == 0' failed

Also, I frequently get a simple "Segmentation fault," with no other error message. What the heck is going on?

Well, I think I may have found my solution. After running threads at different times or eliminating them altogether, I believe I may know what was causing the error. I believe two threads were occasionally trying to write to a text buffer simultaneously through the same instance and that just decimated everything. After making sure only one thread has access to the text buffer, the problem has ceased (for the last hour, at least).

So, I believe my problem has been solved; hopefully this can help somebody in the future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.