From dev-return-59116-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Wed Sep 2 08:12:04 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 3B01C180686 for ; Wed, 2 Sep 2020 10:12:04 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 4E15C121A06 for ; Wed, 2 Sep 2020 08:12:03 +0000 (UTC) Received: (qmail 94161 invoked by uid 500); 2 Sep 2020 08:12:02 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 93999 invoked by uid 99); 2 Sep 2020 08:12:02 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Sep 2020 08:12:02 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B961C43E5B for ; Wed, 2 Sep 2020 08:12:01 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 44B317803B6 for ; Wed, 2 Sep 2020 08:12:00 +0000 (UTC) Date: Wed, 2 Sep 2020 08:12:00 +0000 (UTC) From: "Zezeng Wang (Jira)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (THRIFT-5136) Fix memory leak in thrift_multiplexed_processor_process_impl() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-5136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17189055#comment-17189055 ] Zezeng Wang edited comment on THRIFT-5136 at 9/2/20, 8:11 AM: -------------------------------------------------------------- This pr can indeed repair the double free problem. was (Author: zeshuai007): I did a test afterwards and only assigned the initial value to result, it will still double free. > Fix memory leak in thrift_multiplexed_processor_process_impl() > -------------------------------------------------------------- > > Key: THRIFT-5136 > URL: https://issues.apache.org/jira/browse/THRIFT-5136 > Project: Thrift > Issue Type: Bug > Components: C glib - Library > Reporter: wangyunjian > Assignee: wangyunjian > Priority: Critical > Fix For: 0.14.0 > > Time Spent: 1h 20m > Remaining Estimate: 0h > > The memory leak was triggered on calling thrift_multiplexed_processor_process_impl(). > The variable stored_message_protocol has been malloced, but it hasn't been freed. > Release it directly, there will be other problems. The reason for the problems is that > it will double free fname. The stored message protocol should copy the fname, so we can > free it. > Leak: > Direct leak of 1848 byte(s) in 33 object(s) allocated from: > #0 0x7f2d37eb7ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) > #1 0x7f2d36ee61d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) > #2 0x7f2d36efde06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) > #3 0x7f2d36efe44c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) > #4 0x7f2d37951849 in g_type_create_instance gtype.c:1848 > #5 0x7f2d37933fc7 in g_object_new_internal gobject.c:1799 > #6 0x7f2d37935f4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) > #7 0x7f2d379362ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) > #8 0x7f2d37b8a1b6 in thrift_multiplexed_processor_process_impl src/thrift/c_glib/processor/thrift_multiplexed_processor.c:138 > #9 0x7f2d37bad7bb in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:58 > #10 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #11 0x409341 in main src/test_server.c:278 > #12 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #13 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) > Indirect leak of 256 byte(s) in 1 object(s) allocated from: > #0 0x7f2d37eb7f28 in __interceptor_realloc (/usr/lib64/libasan.so.5+0xeff28) > #1 0x7f2d36ee628d in g_realloc (/usr/lib64/libglib-2.0.so.0+0x5328d) > #2 0x7f2d36eb1728 in g_array_maybe_expand garray.c:794 > #3 0x7f2d36eb1ae9 in g_array_append_vals (/usr/lib64/libglib-2.0.so.0+0x1eae9) > #4 0x7f2d36eb2e0c in g_byte_array_append (/usr/lib64/libglib-2.0.so.0+0x1fe0c) > #5 0x7f2d37ba7068 in thrift_buffered_transport_read_slow src/thrift/c_glib/transport/thrift_buffered_transport.c:122 > #6 0x7f2d37ba729e in thrift_buffered_transport_read src/thrift/c_glib/transport/thrift_buffered_transport.c:152 > #7 0x7f2d37b9f9e4 in thrift_transport_real_read_all src/thrift/c_glib/transport/thrift_transport.c:122 > #8 0x7f2d37b9f8cd in thrift_transport_read_all src/thrift/c_glib/transport/thrift_transport.c:92 > #9 0x7f2d37b957a6 in thrift_binary_protocol_read_binary src/thrift/c_glib/protocol/thrift_binary_protocol.c:841 > #10 0x7f2d37b8fc1b in thrift_protocol_decorator_read_binary src/thrift/c_glib/protocol/thrift_protocol_decorator.c:477 > #11 0x7f2d37b8c4b2 in thrift_protocol_read_binary src/thrift/c_glib/protocol/thrift_protocol.c:418 > #12 0x4740ca in t_test_thrift_test_test_binary_args_read gen-c_glib/t_test_thrift_test_types.c:13562 > #13 0x7f2d37b87865 in thrift_struct_read src/thrift/c_glib/thrift_struct.c:30 > #14 0x42c257 in t_test_thrift_test_processor_process_test_binary gen-c_glib/t_test_thrift_test.c:5665 > #15 0x43412c in t_test_thrift_test_processor_dispatch_call gen-c_glib/t_test_thrift_test.c:7178 > #16 0x7f2d37b892f0 in thrift_dispatch_processor_process src/thrift/c_glib/processor/thrift_dispatch_processor.c:56 > #17 0x7f2d37b8a250 in thrift_multiplexed_processor_process_impl src/thrift/c_glib/processor/thrift_multiplexed_processor.c:149 > #18 0x7f2d37bad7bb in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:58 > #19 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #20 0x409341 in main src/test_server.c:278 > #21 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #22 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) > Indirect leak of 56 byte(s) in 1 object(s) allocated from: > #0 0x7f2d37eb7ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) > #1 0x7f2d36ee61d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) > #2 0x7f2d36efde06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) > #3 0x7f2d36efe44c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) > #4 0x7f2d37951849 in g_type_create_instance gtype.c:1848 > #5 0x7f2d37933fc7 in g_object_new_internal gobject.c:1799 > #6 0x7f2d37935f4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) > #7 0x7f2d379362ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) > #8 0x7f2d37b9ff3f in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 > #9 0x7f2d37bad52c in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 > #10 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #11 0x409341 in main src/test_server.c:278 > #12 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #13 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) > Indirect leak of 40 byte(s) in 1 object(s) allocated from: > #0 0x7f2d37eb7ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) > #1 0x7f2d36ee61d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) > #2 0x7f2d36efde06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) > #3 0x7f2d36eb1894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) > #4 0x7f2d37ba7cf7 in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:266 > #5 0x7f2d379518e9 in g_type_create_instance gtype.c:1866 > #6 0x7f2d37933fc7 in g_object_new_internal gobject.c:1799 > #7 0x7f2d37935f4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) > #8 0x7f2d379362ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) > #9 0x7f2d37b9ff3f in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 > #10 0x7f2d37bad52c in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 > #11 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #12 0x409341 in main src/test_server.c:278 > #13 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #14 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) > Indirect leak of 40 byte(s) in 1 object(s) allocated from: > #0 0x7f2d37eb7ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) > #1 0x7f2d36ee61d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) > #2 0x7f2d36efde06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) > #3 0x7f2d36eb1894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) > #4 0x7f2d37ba7d2c in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:267 > #5 0x7f2d379518e9 in g_type_create_instance gtype.c:1866 > #6 0x7f2d37933fc7 in g_object_new_internal gobject.c:1799 > #7 0x7f2d37935f4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) > #8 0x7f2d379362ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) > #9 0x7f2d37b9ff3f in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 > #10 0x7f2d37bad52c in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 > #11 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #12 0x409341 in main src/test_server.c:278 > #13 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #14 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) > Indirect leak of 32 byte(s) in 1 object(s) allocated from: > #0 0x7f2d37eb7ae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) > #1 0x7f2d36ee61d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) > #2 0x7f2d36efde06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) > #3 0x7f2d36efe44c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) > #4 0x7f2d37951849 in g_type_create_instance gtype.c:1848 > #5 0x7f2d37933fc7 in g_object_new_internal gobject.c:1799 > #6 0x7f2d37935f4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) > #7 0x7f2d379362ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) > #8 0x7f2d37b979b8 in thrift_binary_protocol_factory_get_protocol src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c:30 > #9 0x7f2d37bad670 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:52 > #10 0x7f2d37bac644 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 > #11 0x409341 in main src/test_server.c:278 > #12 0x7f2d366ca872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) > #13 0x404a1d in _start (/mnt/hgfs/share/thrift-0.13.0/test/c_glib/.libs/lt-test_server+0x404a1d) -- This message was sent by Atlassian Jira (v8.3.4#803005)