Re: gupnp and python



On 11/02/13 13:44, Jens Georg wrote:
On Sa, 2013-02-09 at 00:15 +0000, Andrzej Bieniek wrote:

gupnp-python$ gdb --args /usr/bin/python demo.py
[..]
Program received signal SIGSEGV, Segmentation fault.
0xb78f94e1 in g_hash_table_foreach () from
/lib/i386-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0xb78f94e1 in g_hash_table_foreach () from
/lib/i386-linux-gnu/libglib-2.0.so.0
#1  0xb74ff98b in gupnp_service_proxy_end_action_hash () from
/usr/lib/libgupnp-1.0.so.4
#2  0xb74ffaf7 in gupnp_service_proxy_send_action_hash () from
/usr/lib/libgupnp-1.0.so.4
#3  0xb74ffb7b in gupnp_service_proxy_send_action_hash_gi () from
/usr/lib/libgupnp-1.0.so.4
#4  0xb776148e in ffi_call_SYSV () from /usr/lib/i386-linux-gnu/libffi.so.6
[..]

Probably something freeing the hashtable or some of the keys/values
where it shouldn't. Can you valgrind that?

Thanks for replay.
I got a bit more info from gdb and valgrind.

Output dictionary looks ok in gdb #9 {'CurrentVolume': ''}.
Somehow it is "lost" and in #3 gupnp_service_proxy_send_action_hash_gi out_hash looks like uninitialised. What I need to find out is how python dictionary is translated to out_hash table in libgirepository and libffi.

Does valgrind output look ok?

Thanks.
Andrzej

----
* gdb callstack with out_hash and in_hash values in #3
* valgrind log


gupnp-python$ gdb --args /usr/bin/python demo.py
[..]
urn:schemas-upnp-org:service:RenderingControl:1 GetVolume

Program received signal SIGSEGV, Segmentation fault.
0xb78f94e1 in g_hash_table_foreach (hash_table=hash_table entry=0x83f04a0, func=func entry=0xb74fdd40 <read_out_parameter>, user_data=0x83f73a8) at /build/buildd/glib2.0-2.34.1/./glib/ghash.c:1521
1521    /build/buildd/glib2.0-2.34.1/./glib/ghash.c: No such file or directory.
(gdb) bt
#0 0xb78f94e1 in g_hash_table_foreach (hash_table=hash_table entry=0x83f04a0, func=func entry=0xb74fdd40 <read_out_parameter>, user_data=0x83f73a8) at /build/buildd/glib2.0-2.34.1/./glib/ghash.c:1521 #1 0xb74ff98b in gupnp_service_proxy_end_action_hash (proxy=proxy entry=0x83e6408, action=action entry=0x83f5660, error=error entry=
    0xbfffe2e4, hash=hash entry=0x83f04a0) at gupnp-service-proxy.c:1528
#2 0xb74ffaf7 in gupnp_service_proxy_send_action_hash (proxy=proxy entry=0x83e6408, action=action entry=0x83fdec0 "GetVolume", error=error entry=0xbfffe2e4, in_hash=in_hash entry=0x83f3a00, out_hash=out_hash entry=0x83f04a0) at gupnp-service-proxy.c:539 #3 0xb74ffb7b in gupnp_service_proxy_send_action_hash_gi (proxy=0x83e6408, action=0x83fdec0 "GetVolume", in_hash=0x83f3a00, out_hash=
    0x83f04a0, error=0xbfffe2e4) at gupnp-service-proxy.c:486
#4  0xb776148e in ffi_call_SYSV () from /usr/lib/i386-linux-gnu/libffi.so.6
#5  0xb77611ef in ffi_call () from /usr/lib/i386-linux-gnu/libffi.so.6
#6 0xb7a178ed in g_callable_info_invoke () from /usr/lib/libgirepository-1.0.so.1 #7 0xb7a18ec4 in g_function_info_invoke () from /usr/lib/libgirepository-1.0.so.1 #8 0xb7a73e5a in _invoke_callable (function_ptr=0x0, callable_info=0x83efbb0, cache=0x83eef20, state=0xbfffe40c)
    at /build/buildd/pygobject-3.4.0/gi/pygi-invoke.c:64
#9  pygi_callable_info_invoke (info=0x83efbb0, py_args=py_args entry=
(<ServiceProxy at remote 0xb729bb44>, 'GetVolume', {'InstanceID': '0', 'Channel': 'Master'}, {'CurrentVolume': ''}), kwargs=kwargs entry={}, cache=0x83eef20, function_ptr=function_ptr entry=0x0, user_data=user_data entry=0x0)
    at /build/buildd/pygobject-3.4.0/gi/pygi-invoke.c:649
#10 0xb7a74b60 in _wrap_g_callable_info_invoke (self=0xb729c9ac, py_args=
(<ServiceProxy at remote 0xb729bb44>, 'GetVolume', {'InstanceID': '0', 'Channel': 'Master'}, {'CurrentVolume': ''}), kwargs={})
    at /build/buildd/pygobject-3.4.0/gi/pygi-invoke.c:672

[..]
(gdb) f 3
#3 0xb74ffb7b in gupnp_service_proxy_send_action_hash_gi (proxy=0x83e6408, action=0x83fdec0 "GetVolume", in_hash=0x83f3a00, out_hash=
    0x83f04a0, error=0xbfffe2e4) at gupnp-service-proxy.c:486
warning: Source file is more recent than executable.
486 return gupnp_service_proxy_send_action_hash (proxy, action, error, in_hash, out_hash);
(gdb) p *out_hash
$1 = {size = 138361032, mod = 0, mask = 138197104, nnodes = 0, noccupied = 138322776, keys = 0x835d450, hashes = 0x0, values = 0x0, hash_func = 0x0, key_equal_func = 0x0, ref_count = 138307632, version = 0, key_destroy_func = 0x0, value_destroy_func = 0x0}
(gdb) p out_hash
$2 = (GHashTable *) 0x83f04a0
(gdb) p *in_hash
$3 = {size = 8, mod = 7, mask = 7, nnodes = 2, noccupied = 2, keys = 0x83feba8, hashes = 0x83febd0, values = 0x83f52c8, hash_func = 0xb78f97d0 <g_str_hash>, key_equal_func = 0xb78f97a0 <g_str_equal>, ref_count = 1, version = 2, key_destroy_func = 0x0,
  value_destroy_func = 0x0}



gupnp-python/dbg$ valgrind --track-origins=yes python ../demo.py
==3367== Memcheck, a memory error detector
==3367== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==3367== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==3367== Command: python ../demo.py
==3367==
==3367== Invalid read of size 4

[..]

urn:schemas-upnp-org:service:RenderingControl:1 GetVolume
==3367== Invalid read of size 4
==3367==    at 0x4D804DB: g_hash_table_foreach (ghash.c:1520)
==3367== by 0x551C98A: gupnp_service_proxy_end_action_hash (in /usr/lib/libgupnp-1.0.so.4.0.0)
==3367==    by 0xBEA8E1D3: ???
==3367==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==3367==
==3367==
==3367== Process terminating with default action of signal 11 (SIGSEGV)
==3367==  Access not within mapped region at address 0x0
==3367==    at 0x4D804DB: g_hash_table_foreach (ghash.c:1520)
==3367== by 0x551C98A: gupnp_service_proxy_end_action_hash (in /usr/lib/libgupnp-1.0.so.4.0.0)
==3367==    by 0xBEA8E1D3: ???
==3367==  If you believe this happened as a result of a stack
==3367==  overflow in your program's main thread (unlikely but
==3367==  possible), you can try to increase the size of the
==3367==  main thread stack using the --main-stacksize= flag.
==3367==  The main thread stack size used in this run was 8388608.
==3367==
==3367== HEAP SUMMARY:
==3367==     in use at exit: 3,500,636 bytes in 3,980 blocks
==3367== total heap usage: 17,166 allocs, 13,186 frees, 10,200,095 bytes allocated
==3367==
==3367== LEAK SUMMARY:
==3367==    definitely lost: 0 bytes in 0 blocks
==3367==    indirectly lost: 0 bytes in 0 blocks
==3367==      possibly lost: 117,395 bytes in 692 blocks
==3367==    still reachable: 3,383,241 bytes in 3,288 blocks
==3367==         suppressed: 0 bytes in 0 blocks
==3367== Rerun with --leak-check=full to see details of leaked memory
==3367==
==3367== For counts of detected and suppressed errors, rerun with: -v
==3367== ERROR SUMMARY: 698 errors from 78 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]