wangyunjian created THRIFT-5102: ----------------------------------- Summary: Fix memory leak in thrift_simple_server_serve() Key: THRIFT-5102 URL: https://issues.apache.org/jira/browse/THRIFT-5102 Project: Thrift Issue Type: Bug Components: C glib - Library Affects Versions: 0.13.0 Reporter: wangyunjian
The memory leak was triggered on calling in thrift_simple_server_serve(). The objects (t, input_transport, output_transport, input_protocol and output_protocol) are malloced and them has not been deleted. Leak: Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82b01344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) #4 0x7fe82ba66849 in g_type_create_instance gtype.c:1848 #5 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #6 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #7 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #8 0x7fe82bcac928 in thrift_binary_protocol_factory_get_protocol src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c:30 #9 0x7fe82bcc25a6 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:55 #10 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #11 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #12 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #13 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82b01344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) #4 0x7fe82ba66849 in g_type_create_instance gtype.c:1848 #5 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #6 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #7 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #8 0x7fe82bcac928 in thrift_binary_protocol_factory_get_protocol src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c:30 #9 0x7fe82bcc2504 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:52 #10 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #11 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #12 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #13 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccf28 in __interceptor_realloc (/usr/lib64/libasan.so.5+0xeff28) #1 0x7fe82affb28d in g_realloc (/usr/lib64/libglib-2.0.so.0+0x5328d) #2 0x7fe82afc6728 in g_array_maybe_expand garray.c:794 #3 0x7fe82afc6ae9 in g_array_append_vals (/usr/lib64/libglib-2.0.so.0+0x1eae9) #4 0x7fe82afc7e0c in g_byte_array_append (/usr/lib64/libglib-2.0.so.0+0x1fe0c) #5 0x7fe82bcbc801 in thrift_buffered_transport_write src/thrift/c_glib/transport/thrift_buffered_transport.c:220 #6 0x7fe82bcb46d6 in thrift_transport_write src/thrift/c_glib/transport/thrift_transport.c:71 #7 0x7fe82bca6ebf in thrift_binary_protocol_write_i16 src/thrift/c_glib/protocol/thrift_binary_protocol.c:292 #8 0x7fe82bca081a in thrift_protocol_write_i16 src/thrift/c_glib/protocol/thrift_protocol.c:202 #9 0x7fe82bca646a in thrift_binary_protocol_write_field_begin src/thrift/c_glib/protocol/thrift_binary_protocol.c:133 #10 0x7fe82bca02eb in thrift_protocol_write_field_begin src/thrift/c_glib/protocol/thrift_protocol.c:111 #11 0x40e40b in shared_struct_write gen-c_glib/shared_types.c:140 #12 0x7fe82bc9c912 in thrift_struct_write src/thrift/c_glib/thrift_struct.c:38 #13 0x410327 in shared_service_get_struct_result_write gen-c_glib/shared_types.c:635 #14 0x7fe82bc9c912 in thrift_struct_write src/thrift/c_glib/thrift_struct.c:38 #15 0x40ccf8 in shared_service_processor_process_get_struct gen-c_glib/shared_service.c:431 #16 0x40d1f4 in shared_service_processor_dispatch_call gen-c_glib/shared_service.c:498 #17 0x40a4d3 in calculator_processor_dispatch_call gen-c_glib/calculator.c:1205 #18 0x7fe82bc9e260 in thrift_dispatch_processor_process src/thrift/c_glib/processor/thrift_dispatch_processor.c:56 #19 0x7fe82bcc264f in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:58 #20 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #21 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #22 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #23 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82b01344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) #4 0x7fe82ba66849 in g_type_create_instance gtype.c:1848 #5 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #6 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #7 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #8 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #9 0x7fe82bcc2462 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:49 #10 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #11 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #12 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #13 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82b01344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) #4 0x7fe82ba66849 in g_type_create_instance gtype.c:1848 #5 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #6 0x7fe82ba4a714 in g_object_new_with_properties (/usr/lib64/libgobject-2.0.so.0+0x17714) #7 0x7fe82ba4b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0) #8 0x7fe82bcbab71 in thrift_server_socket_accept src/thrift/c_glib/transport/thrift_server_socket.c:154 #9 0x7fe82bcb9cc5 in thrift_server_transport_accept src/thrift/c_glib/transport/thrift_server_transport.c:53 #10 0x7fe82bcc22c8 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:42 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82b01344c in g_slice_alloc0 (/usr/lib64/libglib-2.0.so.0+0x6b44c) #4 0x7fe82ba66849 in g_type_create_instance gtype.c:1848 #5 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #6 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #7 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #8 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #9 0x7fe82bcc23c0 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 #10 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #11 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #12 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #13 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82afc6894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) #4 0x7fe82bcbcb8b in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:266 #5 0x7fe82ba668e9 in g_type_create_instance gtype.c:1866 #6 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #7 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #8 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #9 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #10 0x7fe82bcc2462 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:49 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82afc6894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) #4 0x7fe82bcbcbc0 in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:267 #5 0x7fe82ba668e9 in g_type_create_instance gtype.c:1866 #6 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #7 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #8 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #9 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #10 0x7fe82bcc23c0 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82afc6894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) #4 0x7fe82bcbcb8b in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:266 #5 0x7fe82ba668e9 in g_type_create_instance gtype.c:1866 #6 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #7 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #8 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #9 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #10 0x7fe82bcc23c0 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:46 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b012e06 in g_slice_alloc (/usr/lib64/libglib-2.0.so.0+0x6ae06) #3 0x7fe82afc6894 in g_array_sized_new (/usr/lib64/libglib-2.0.so.0+0x1e894) #4 0x7fe82bcbcbc0 in thrift_buffered_transport_init src/thrift/c_glib/transport/thrift_buffered_transport.c:267 #5 0x7fe82ba668e9 in g_type_create_instance gtype.c:1866 #6 0x7fe82ba48fc7 in g_object_new_internal gobject.c:1799 #7 0x7fe82ba4af4d in g_object_new_valist (/usr/lib64/libgobject-2.0.so.0+0x17f4d) #8 0x7fe82ba4b2ac in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182ac) #9 0x7fe82bcb4eaf in thrift_buffered_transport_factory_get_transport src/thrift/c_glib/transport/thrift_buffered_transport_factory.c:35 #10 0x7fe82bcc2462 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:49 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 16 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccf28 in __interceptor_realloc (/usr/lib64/libasan.so.5+0xeff28) #1 0x7fe82affb28d in g_realloc (/usr/lib64/libglib-2.0.so.0+0x5328d) #2 0x7fe82afc6728 in g_array_maybe_expand garray.c:794 #3 0x7fe82afc6ae9 in g_array_append_vals (/usr/lib64/libglib-2.0.so.0+0x1eae9) #4 0x7fe82afc7e0c in g_byte_array_append (/usr/lib64/libglib-2.0.so.0+0x1fe0c) #5 0x7fe82bcbbefc in thrift_buffered_transport_read_slow src/thrift/c_glib/transport/thrift_buffered_transport.c:122 #6 0x7fe82bcbc132 in thrift_buffered_transport_read src/thrift/c_glib/transport/thrift_buffered_transport.c:152 #7 0x7fe82bcb4954 in thrift_transport_real_read_all src/thrift/c_glib/transport/thrift_transport.c:122 #8 0x7fe82bcb483d in thrift_transport_read_all src/thrift/c_glib/transport/thrift_transport.c:92 #9 0x7fe82bca9703 in thrift_binary_protocol_read_i32 src/thrift/c_glib/protocol/thrift_binary_protocol.c:713 #10 0x7fe82bca1235 in thrift_protocol_read_i32 src/thrift/c_glib/protocol/thrift_protocol.c:386 #11 0x7fe82bca7c76 in thrift_binary_protocol_read_message_begin src/thrift/c_glib/protocol/thrift_binary_protocol.c:410 #12 0x7fe82bca0b09 in thrift_protocol_read_message_begin src/thrift/c_glib/protocol/thrift_protocol.c:252 #13 0x7fe82bc9e071 in thrift_dispatch_processor_process src/thrift/c_glib/processor/thrift_dispatch_processor.c:41 #14 0x7fe82bcc264f in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:58 #15 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #16 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #17 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #18 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) Indirect leak of 10 byte(s) in 1 object(s) allocated from: #0 0x7fe82bfccae8 in __interceptor_malloc (/usr/lib64/libasan.so.5+0xefae8) #1 0x7fe82affb1d5 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x531d5) #2 0x7fe82b014b32 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x6cb32) #3 0x7fe82bcb68bc in thrift_socket_set_property src/thrift/c_glib/transport/thrift_socket.c:362 #4 0x7fe82ba49378 in object_set_property gobject.c:1441 #5 0x7fe82ba49378 in g_object_new_internal gobject.c:1833 #6 0x7fe82ba4a714 in g_object_new_with_properties (/usr/lib64/libgobject-2.0.so.0+0x17714) #7 0x7fe82ba4b2d0 in g_object_new (/usr/lib64/libgobject-2.0.so.0+0x182d0) #8 0x7fe82bcbab71 in thrift_server_socket_accept src/thrift/c_glib/transport/thrift_server_socket.c:154 #9 0x7fe82bcb9cc5 in thrift_server_transport_accept src/thrift/c_glib/transport/thrift_server_transport.c:53 #10 0x7fe82bcc22c8 in thrift_simple_server_serve src/thrift/c_glib/server/thrift_simple_server.c:42 #11 0x7fe82bcc14d8 in thrift_server_serve src/thrift/c_glib/server/thrift_server.c:108 #12 0x404143 in main /mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/c_glib_server.c:506 #13 0x7fe82a7df872 in __libc_start_main (/usr/lib64/libc.so.6+0x23872) #14 0x402a3d in _start (/mnt/hgfs/develop/thrift-0.13.0/tutorial/c_glib/.libs/lt-tutorial_server+0x402a3d) -- This message was sent by Atlassian Jira (v8.3.4#803005)