Treferwynd / transmission-remote-gtk

Automatically exported from code.google.com/p/transmission-remote-gtk
GNU General Public License v2.0
0 stars 0 forks source link

json parsing concurrency problem? #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Quickly selecting one torrent after another I got with 1.0.2 following:
(transmission-remote-gtk:13837): Json-CRITICAL **: json_array_get_int_element: 
assertion `index_ < array->elements->len' failed

Original issue reported on code.google.com by andrey.s...@googlemail.com on 16 Jul 2012 at 3:20

GoogleCodeExporter commented 9 years ago
Here is a trace:

...
[New Thread 0x7fffe098a700 (LWP 13915)]

Json-CRITICAL **: json_array_get_int_element: assertion `index_ < 
array->elements->len' failed
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe118b700 (LWP 13914)]
0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff3f006f0 in *__GI_abort () at abort.c:92
#2  0x00007ffff492e32a in g_logv () from /lib/libglib-2.0.so.0
#3  0x00007ffff492e3b3 in g_log () from /lib/libglib-2.0.so.0
#4  0x00007ffff793f99a in json_array_get_int_element () from 
/usr/lib/x86_64-linux-gnu/libjson-glib-1.0.so.0
#5  0x0000000000423d56 in trg_file_parser_node_insert (priorities=0x2067c80, 
enabled=0x2067ca0, index=10557, 
    file=0x188ae20, last=<optimized out>, top=<optimized out>) at trg-files-model.c:224
#6  trg_files_model_buildtree_threadfunc (data=0x979000) at 
trg-files-model.c:366
#7  0x00007ffff494ccf6 in ?? () from /lib/libglib-2.0.so.0
#8  0x00007ffff4258b50 in start_thread (arg=<optimized out>) at 
pthread_create.c:304
#9  0x00007ffff3fa36dd in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()
(gdb) 

Original comment by andrey.s...@googlemail.com on 16 Jul 2012 at 3:26

GoogleCodeExporter commented 9 years ago
Hi,

A backtrace would be needed before I can investigate, you can use G_DEBUG to 
make it abort on the above assertion. Debugging symbols for 
transmission-remote-gtk will need to be present:

1) G_DEBUG=fatal-criticals gdb transmission-remote-gtk
2) gdb command: run
3) reproduce
4) attach output of "bt full"

Original comment by a...@eth0.org.uk on 16 Jul 2012 at 3:28

GoogleCodeExporter commented 9 years ago
One more trace. Could it be relevant? Or should I open a new issue?

...
[Thread 0x7fffe33c3700 (LWP 13933) exited]

Gtk-WARNING **: Failed to set text from markup due to error parsing markup: 
Error on line 1: Entity did not end with a semicolon; most likely you used an 
ampersand character without intending to start an entity - escape ampersand as &
aborting...

Program received signal SIGABRT, Aborted.
0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff3f006f0 in *__GI_abort () at abort.c:92
#2  0x00007ffff492e32a in g_logv () from /lib/libglib-2.0.so.0
#3  0x00007ffff492e3b3 in g_log () from /lib/libglib-2.0.so.0
#4  0x00007ffff6fde1eb in ?? () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#5  0x00007ffff6fdf3a0 in gtk_label_set_markup () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#6  0x000000000042796f in trg_general_panel_update (panel=<optimized out>, 
t=0x1fd2960, iter=iter@entry=0x7fffffffd480)
    at trg-general-panel.c:183
#7  0x0000000000410c3f in update_selected_torrent_notebook 
(win=win@entry=0x6f6000, mode=mode@entry=0, id=302)
    at trg-main-window.c:298
#8  0x0000000000410f72 in torrent_selection_changed (selection=<optimized out>, 
win=0x6f6000) at trg-main-window.c:1526
#9  0x00007ffff51efe7e in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#10 0x00007ffff52018d7 in ?? () from /usr/lib/libgobject-2.0.so.0
#11 0x00007ffff520ad05 in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#12 0x00007ffff520aed3 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#13 0x00007ffff70e9b6c in ?? () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#14 0x00007ffff70ecf6b in ?? () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#15 0x00007ffff6fed148 in ?? () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#16 0x00007ffff51efe7e in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#17 0x00007ffff52016e8 in ?? () from /usr/lib/libgobject-2.0.so.0
#18 0x00007ffff520aaa5 in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#19 0x00007ffff520aed3 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#20 0x00007ffff7105f91 in ?? () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#21 0x00007ffff6feb343 in gtk_propagate_event () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#22 0x00007ffff6feb6a3 in gtk_main_do_event () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#23 0x00007ffff6c571dc in ?? () from 
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#24 0x00007ffff49254a3 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#25 0x00007ffff4925c80 in ?? () from /lib/libglib-2.0.so.0
#26 0x00007ffff49262f2 in g_main_loop_run () from /lib/libglib-2.0.so.0
#27 0x00007ffff6fea6f7 in gtk_main () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#28 0x000000000040f9f1 in trg_libunique_init (args=0x64b980, 
argv=0x7fffffffe288, argc=1, client=<optimized out>)
    at main.c:137
#29 main (argc=1, argv=0x7fffffffe288) at main.c:286
(gdb) 

Original comment by andrey.s...@googlemail.com on 16 Jul 2012 at 3:30

GoogleCodeExporter commented 9 years ago
bt full for the first one.
By the way, I've used the debian package (thanks to your debian dir :) ), thus 
-dbg package supplied the debug info.
Among DEBUG= there is also flag --g-fatal-warnings, which I used. This flag 
should be handled only by glib, but the program receives it and complains there 
is no such torrent file.

...
[New Thread 0x7fffe5070700 (LWP 13942)]

Json-CRITICAL **: json_array_get_int_element: assertion `index_ < 
array->elements->len' failed
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe5871700 (LWP 13941)]
0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt full
#0  0x00007ffff3efd475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
        pid = <optimized out>
        selftid = <optimized out>
#1  0x00007ffff3f006f0 in *__GI_abort () at abort.c:92
        act = {__sigaction_handler = {sa_handler = 0x2, sa_sigaction = 0x2}, sa_mask = {__val = {140737296647249,
              140736820784448, 140737296741825, 140736820784448, 140736817266720, 140737285790624, 140737353962720,
              140736817752464, 4294967295, 2, 5, 3077752, 0, 140737044220640, 0, 140737296334848}},
          sa_flags = -136402446, sa_restorer = 0x5}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff492e32a in g_logv () from /lib/libglib-2.0.so.0
No symbol table info available. 
#3  0x00007ffff492e3b3 in g_log () from /lib/libglib-2.0.so.0
No symbol table info available.
#4  0x00007ffff793f99a in json_array_get_int_element () from 
/usr/lib/x86_64-linux-gnu/libjson-glib-1.0.so.0
No symbol table info available.
#5  0x0000000000423d56 in trg_file_parser_node_insert (priorities=0xa44470, 
enabled=0xa44490, index=5256, file=0x1134540,
    last=<optimized out>, top=<optimized out>) at trg-files-model.c:224
        isFile = <optimized out>
        target_node = 0x7fffd8010800
        lastIter = 0x7fffd8010800
        parentList = 0x0
        path_el = <optimized out>
        i = <optimized out>
        path = 0x7fffd8355840
        li = 0x0
#6  trg_files_model_buildtree_threadfunc (data=0x7fffd800b450) at 
trg-files-model.c:366
        file = 0x1134540 
        args = 0x7fffd800b450
        priv = 0x809080
        lastNode = <optimized out>
        li = 0x7fffd80b0aa0
#7  0x00007ffff494ccf6 in ?? () from /lib/libglib-2.0.so.0
No symbol table info available.
#8  0x00007ffff4258b50 in start_thread (arg=<optimized out>) at 
pthread_create.c:304
        __res = <optimized out>
        pd = 0x7fffe5871700
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737044223744, 5841734971119522976, 140737488343824,
                140737044224448, 140737354125376, 3, -5841793172850715488, -5841754436562430816}, mask_was_saved = 0}},
          priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#9  0x00007ffff3fa36dd in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
No locals.
#10 0x0000000000000000 in ?? ()
No symbol table info available.
(gdb)   

Original comment by andrey.s...@googlemail.com on 16 Jul 2012 at 3:41

GoogleCodeExporter commented 9 years ago
Thanks for the details. I think I see - the first torrent must have over 600 
files causing it to build the tree in a thread to prevent a hang, then it hands 
over to an idle callback in the mainloop which displays the tree. I'd added a 
check in here so if there is a change of torrent in between so it won't display 
the results of the work in the thread. I think it's harmless but it is a 
concurrency issue and I will fix it over the next few days. 

Some of the work in that thread is against the wanted/priorities array for the 
newer torrent, which is smaller and hence the assertion.

Yes please, that looks like a seperate issue. Seems to be in the code which 
adds a URL to comments using pango markup. If you could show me the comment or 
its format that could help.

Original comment by a...@eth0.org.uk on 16 Jul 2012 at 3:56

GoogleCodeExporter commented 9 years ago
OK, thanks for explanations!

Original comment by andrey.s...@googlemail.com on 16 Jul 2012 at 4:21

GoogleCodeExporter commented 9 years ago
The concurrency issue is fixed, I started looking at the URL/comment problem 
but have put it on hold for a bit.

Original comment by a...@eth0.org.uk on 18 Jul 2012 at 11:42