You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Roger Meier (JIRA)" <ji...@apache.org> on 2014/03/23 22:31:43 UTC

[jira] [Commented] (THRIFT-2414) c_glib fix several bug.

    [ https://issues.apache.org/jira/browse/THRIFT-2414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944587#comment-13944587 ] 

Roger Meier commented on THRIFT-2414:
-------------------------------------

I had this issue with your patch:
{noformat}
/testbinaryprotocol/ReadAndWritePrimitives: *** glibc detected *** ./testbinaryprotocol: double free or corruption (fasttop): 0x0000000002587730 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x2b59e206cd76]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x2b59e2071b1c]
./testbinaryprotocol[0x405274]
./testbinaryprotocol[0x403f87]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x6bb5d)[0x2b59e12ecb5d]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x6bcd6)[0x2b59e12eccd6]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_test_run_suite+0x18b)[0x2b59e12ed03b]
./testbinaryprotocol[0x405d12]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x2b59e2014ead]
./testbinaryprotocol[0x401969]
======= Memory map: ========
00400000-0040c000 r-xp 00000000 fd:02 2692988193                         /home/roger/software/thrift/thrift-git/lib/c_glib/test/testbinaryprotocol
0060c000-0060d000 rw-p 0000c000 fd:02 2692988193                         /home/roger/software/thrift/thrift-git/lib/c_glib/test/testbinaryprotocol
02577000-02598000 rw-p 00000000 00:00 0                                  [heap]
2b59e0e0f000-2b59e0e2f000 r-xp 00000000 fd:00 270919192                  /lib/x86_64-linux-gnu/ld-2.13.so
2b59e0e2f000-2b59e0e31000 rw-p 00000000 00:00 0
2b59e0e31000-2b59e0e38000 r--s 00000000 fd:00 674646189                  /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
2b59e0e38000-2b59e0e39000 rw-p 00000000 00:00 0
2b59e102e000-2b59e102f000 r--p 0001f000 fd:00 270919192                  /lib/x86_64-linux-gnu/ld-2.13.so
2b59e102f000-2b59e1030000 rw-p 00020000 fd:00 270919192                  /lib/x86_64-linux-gnu/ld-2.13.so
2b59e1030000-2b59e1031000 rw-p 00000000 00:00 0
2b59e1031000-2b59e107f000 r-xp 00000000 fd:00 406084557                  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3200.4
2b59e107f000-2b59e127f000 ---p 0004e000 fd:00 406084557                  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3200.4
2b59e127f000-2b59e1280000 r--p 0004e000 fd:00 406084557                  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3200.4
2b59e1280000-2b59e1281000 rw-p 0004f000 fd:00 406084557                  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.3200.4
2b59e1281000-2b59e1376000 r-xp 00000000 fd:00 268631384                  /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4
2b59e1376000-2b59e1576000 ---p 000f5000 fd:00 268631384                  /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4
2b59e1576000-2b59e1577000 r--p 000f5000 fd:00 268631384                  /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4
2b59e1577000-2b59e1578000 rw-p 000f6000 fd:00 268631384                  /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4
2b59e1578000-2b59e157a000 rw-p 00000000 00:00 0
2b59e157a000-2b59e15d0000 r-xp 00000000 fd:00 406359873                  /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
2b59e15d0000-2b59e17d0000 ---p 00056000 fd:00 406359873                  /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
2b59e17d0000-2b59e17d3000 r--p 00056000 fd:00 406359873                  /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
2b59e17d3000-2b59e17da000 rw-p 00059000 fd:00 406359873                  /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
2b59e17da000-2b59e19a4000 r-xp 00000000 fd:00 406359871                  /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
2b59e19a4000-2b59e1ba3000 ---p 001ca000 fd:00 406359871                  /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
2b59e1ba3000-2b59e1bbe000 r--p 001c9000 fd:00 406359871                  /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
2b59e1bbe000-2b59e1bcd000 rw-p 001e4000 fd:00 406359871                  /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
2b59e1bcd000-2b59e1bd1000 rw-p 00000000 00:00 0
2b59e1bd1000-2b59e1bd8000 r-xp 00000000 fd:00 270919190                  /lib/x86_64-linux-gnu/librt-2.13.so
2b59e1bd8000-2b59e1dd7000 ---p 00007000 fd:00 270919190                  /lib/x86_64-linux-gnu/librt-2.13.so
2b59e1dd7000-2b59e1dd8000 r--p 00006000 fd:00 270919190                  /lib/x86_64-linux-gnu/librt-2.13.so
2b59e1dd8000-2b59e1dd9000 rw-p 00007000 fd:00 270919190                  /lib/x86_64-linux-gnu/librt-2.13.so
2b59e1dd9000-2b59e1dda000 rw-p 00000000 00:00 0
2b59e1dda000-2b59e1df1000 r-xp 00000000 fd:00 270916333                  /lib/x86_64-linux-gnu/libpthread-2.13.so
2b59e1df1000-2b59e1ff0000 ---p 00017000 fd:00 270916333                  /lib/x86_64-linux-gnu/libpthread-2.13.so
2b59e1ff0000-2b59e1ff1000 r--p 00016000 fd:00 270916333                  /lib/x86_64-linux-gnu/libpthread-2.13.so
2b59e1ff1000-2b59e1ff2000 rw-p 00017000 fd:00 270916333                  /lib/x86_64-linux-gnu/libpthread-2.13.so
2b59e1ff2000-2b59e1ff6000 rw-p 00000000 00:00 0
2b59e1ff6000-2b59e2178000 r-xp 00000000 fd:00 268628386                  /lib/x86_64-linux-gnu/libc-2.13.so
2b59e2178000-2b59e2377000 ---p 00182000 fd:00 268628386                  /lib/x86_64-linux-gnu/libc-2.13.so
2b59e2377000-2b59e237b000 r--p 00181000 fd:00 268628386                  /lib/x86_64-linux-gnu/libc-2.13.so
2b59e237b000-2b59e237c000 rw-p 00185000 fd:00 268628386                  /lib/x86_64-linux-gnu/libc-2.13.so
2b59e237c000-2b59e2381000 rw-p 00000000 00:00 0
2b59e2381000-2b59e2382000 r-xp 00000000 fd:00 406084558                  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.3200.4
2b59e2382000-2b59e2581000 ---p 00001000 fd:00 406084558                  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.3200.4
2b59e2581000-2b59e2582000 r--p 00000000 fd:00 406084558                  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.3200.4
2b59e2582000-2b59e2583000 rw-p 00001000 fd:00 406084558                  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.3200.4
2b59e2583000-2b59e2584000 rw-p 00000000 00:00 0
2b59e2584000-2b59e2590000 r-xp 00000000 fd:00 427591110                  /usr/lib/x86_64-linux-gnu/libffi.so.5.0.10
2b59e2590000-2b59e2790000 ---p 0000c000 fd:00 427591110                  /usr/lib/x86_64-linux-gnu/libffi.so.5.0.10
2b59e2790000-2b59e2791000 rw-p 0000c000 fd:00 427591110                  /usr/lib/x86_64-linux-gnu/libffi.so.5.0.10
2b59e2791000-2b59e27cd000 r-xp 00000000 fd:00 268935011                  /lib/x86_64-linux-gnu/libpcre.so.3.13.1
2b59e27cd000-2b59e29cd000 ---p 0003c000 fd:00 268935011                  /lib/x86_64-linux-gnu/libpcre.so.3.13.1
2b59e29cd000-2b59e29ce000 rw-p 0003c000 fd:00 268935011                  /lib/x86_64-linux-gnu/libpcre.so.3.13.1
2b59e29ce000-2b59e29d0000 r-xp 00000000 fd:00 270916312                  /lib/x86_64-linux-gnu/libdl-2.13.so
2b59e29d0000-2b59e2bd0000 ---p 00002000 fd:00 270916312                  /lib/x86_64-linux-gnu/libdl-2.13.so
2b59e2bd0000-2b59e2bd1000 r--p 00002000 fd:00 270916312                  /lib/x86_64-linux-gnu/libdl-2.13.so
2b59e2bd1000-2b59e2bd2000 rw-p 00003000 fd:00 270916312                  /lib/x86_64-linux-gnu/libdl-2.13.so
2b59e2bd2000-2b59e2bd3000 rw-p 00000000 00:00 0
2b59e2bd3000-2b59e2be9000 r-xp 00000000 fd:00 269306590                  /lib/x86_64-linux-gnu/libz.so.1.2.7
2b59e2be9000-2b59e2de8000 ---p 00016000 fd:00 269306590                  /lib/x86_64-linux-gnu/libz.so.1.2.7
2b59e2de8000-2b59e2de9000 r--p 00015000 fd:00 269306590                  /lib/x86_64-linux-gnu/libz.so.1.2.7
2b59e2de9000-2b59e2dea000 rw-p 00016000 fd:00 269306590                  /lib/x86_64-linux-gnu/libz.so.1.2.7
2b59e2dea000-2b59e2dec000 rw-p 00000000 00:00 0
2b59e2e11000-2b59e2e26000 r-xp 00000000 fd:00 268631743                  /lib/x86_64-linux-gnu/libgcc_s.so.1
2b59e2e26000-2b59e3026000 ---p 00015000 fd:00 268631743                  /lib/x86_64-linux-gnu/libgcc_s.so.1
2b59e3026000-2b59e3027000 rw-p 00015000 fd:00 268631743                  /lib/x86_64-linux-gnu/libgcc_s.so.1
2b59e4000000-2b59e4021000 rw-p 00000000 00:00 0
2b59e4021000-2b59e8000000 ---p 00000000 00:00 0
7ffff0469000-7ffff048a000 rw-p 00000000 00:00 0                          [stack]
7ffff058b000-7ffff058c000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
testbinaryprotocol: testbinaryprotocol.c:196: test_read_and_write_primitives: Assertion `status == 0' failed.
/bin/sh: line 5: 24679 Aborted                 ${dir}$tst
FAIL: testbinaryprotocol
{noformat}

> c_glib fix several bug.
> -----------------------
>
>                 Key: THRIFT-2414
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2414
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Compiler, C glib - Library
>    Affects Versions: 0.7, 0.8
>            Reporter: Jaesang Kim
>             Fix For: 0.9
>
>         Attachments: thrift-2414-c_glib-bug-fix.patch
>
>
> 1. leaks in binary string
> thrift generate the "binary" type to GByteArray pointer. GByteArray must be freed with g_byte_array_unref().
> 2. not use *_array_free
> use *_array_unref function for the code readability
> 3. leaks in ThriftApplicationException class
> ThriftApplicationException class has no finalize function. To free a message attribute in ThriftApplicationException object, attach finalize function.
> 4. handle a error in thrift_buffered_transport_read_slow()
> if read function return a value less than zero, stop read and return.
> 5. use gethostbyname_r() function instead of gethostbyname()
> thrift client for parallel access. change to reentrant function.
> 6. use SO_LINGER for daemon application
> set thrift client socket's SO_LINGER option to {1, 0). for daemon application.



--
This message was sent by Atlassian JIRA
(v6.2#6252)