Bug 762647 (GLUSTER-915)

Summary: memory leak in server protocol
Product: [Community] GlusterFS Reporter: Raghavendra Bhat <rabhat>
Component: protocolAssignee: Vijay Bellur <vbellur>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.9CC: gluster-bugs, vijay
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Raghavendra Bhat 2010-05-10 08:50:54 UTC
There is a memory leak in server protocol. leak is found in server_lookup and server_xattrop. 

This is the valgrind output mentioning the leak for server_lookup

20,052 (1,632 direct, 18,420 indirect) bytes in 34 blocks are definitely lost in loss record 94 of 109
==4406==    at 0x4C2414B: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4406==    by 0x4E34390: get_new_dict_full (dict.c:68)
==4406==    by 0x4E344AA: dict_new (dict.c:101)
==4406==    by 0x6A496D6: server_lookup (server-protocol.c:3477)
==4406==    by 0x6A564DF: protocol_server_interpret (server-protocol.c:7482)
==4406==    by 0x6A5702B: protocol_server_pollin (server-protocol.c:7763)
==4406==    by 0x6A57239: notify (server-protocol.c:7819)
==4406==    by 0x7B6EEDC: socket_event_poll_in (socket.c:714)
==4406==    by 0x7B6F1DF: socket_event_handler (socket.c:814)
==4406==    by 0x4E5CA6A: event_dispatch_epoll_handler (event.c:804)
==4406==    by 0x4E5CC39: event_dispatch_epoll (event.c:867)
==4406==    by 0x4E5CF4A: event_dispatch (event.c:975)
==4406== 
==4406== 21,496 (720 direct, 20,776 indirect) bytes in 18 blocks are definitely lost in loss record 95 of 109
==4406==    at 0x4C2414B: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4406==    by 0x4E34A74: _dict_set (dict.c:234)
==4406==    by 0x4E34CC1: dict_set (dict.c:281)
==4406==    by 0x4E38F19: dict_unserialize (dict.c:2389)
==4406==    by 0x6A49749: server_lookup (server-protocol.c:3480)
==4406==    by 0x6A564DF: protocol_server_interpret (server-protocol.c:7482)
==4406==    by 0x6A5702B: protocol_server_pollin (server-protocol.c:7763)
==4406==    by 0x6A57239: notify (server-protocol.c:7819)
==4406==    by 0x7B6EEDC: socket_event_poll_in (socket.c:714)
==4406==    by 0x7B6F1DF: socket_event_handler (socket.c:814)
==4406==    by 0x4E5CA6A: event_dispatch_epoll_handler (event.c:804)
==4406==    by 0x4E5CC39: event_dispatch_epoll (event.c:867)

This is the leak mentioned by valgrind for server_xattrop.


3,309,792 (479,680 direct, 2,830,112 indirect) bytes in 11,992 blocks are definitely lost in loss record 107 of 109
==4406==    at 0x4C2414B: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4406==    by 0x4E34A74: _dict_set (dict.c:234)
==4406==    by 0x4E34CC1: dict_set (dict.c:281)
==4406==    by 0x4E38F19: dict_unserialize (dict.c:2389)
==4406==    by 0x6A4DCB7: server_xattrop (server-protocol.c:4677)
==4406==    by 0x6A564DF: protocol_server_interpret (server-protocol.c:7482)
==4406==    by 0x6A5702B: protocol_server_pollin (server-protocol.c:7763)
==4406==    by 0x6A57239: notify (server-protocol.c:7819)
==4406==    by 0x7B6EEDC: socket_event_poll_in (socket.c:714)
==4406==    by 0x7B6F1DF: socket_event_handler (socket.c:814)
==4406==    by 0x4E5CA6A: event_dispatch_epoll_handler (event.c:804)
==4406==    by 0x4E5CC39: event_dispatch_epoll (event.c:867)
==4406== 
==4406== 10,249,080 (1,960,416 direct, 8,288,664 indirect) bytes in 40,842 blocks are definitely lost in loss record 109 of 109
==4406==    at 0x4C2414B: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4406==    by 0x4E34390: get_new_dict_full (dict.c:68)
==4406==    by 0x4E344AA: dict_new (dict.c:101)
==4406==    by 0x6A4DC44: server_xattrop (server-protocol.c:4674)
==4406==    by 0x6A564DF: protocol_server_interpret (server-protocol.c:7482)
==4406==    by 0x6A5702B: protocol_server_pollin (server-protocol.c:7763)
==4406==    by 0x6A57239: notify (server-protocol.c:7819)
==4406==    by 0x7B6EEDC: socket_event_poll_in (socket.c:714)
==4406==    by 0x7B6F1DF: socket_event_handler (socket.c:814)
==4406==    by 0x4E5CA6A: event_dispatch_epoll_handler (event.c:804)
==4406==    by 0x4E5CC39: event_dispatch_epoll (event.c:867)
==4406==    by 0x4E5CF4A: event_dispatch (event.c:975)
==4406== 
==4406== LEAK SUMMARY:
==4406==    definitely lost: 2,442,766 bytes in 52,903 blocks
==4406==    indirectly lost: 11,157,972 bytes in 315,696 blocks
==4406==      possibly lost: 420,948 bytes in 5,144 blocks
==4406==    still reachable: 881,456 bytes in 132 blocks
==4406==         suppressed: 0 bytes in 0 blocks

Comment 1 Anand Avati 2010-05-11 14:10:09 UTC
PATCH: http://patches.gluster.com/patch/3253 in release-2.0 (unref dict by destroying stub in server_stub_resume to avoid leak in lookup and xattrop)