Bug 762725 (GLUSTER-993)

Summary: memory leak-in stat-prefetch
Product: [Community] GlusterFS Reporter: Raghavendra Bhat <rabhat>
Component: stat-prefetchAssignee: Raghavendra G <raghavendra>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: low    
Version: 3.0.4CC: tejas, 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-06-11 06:27:47 UTC
this is observed in 3.0.5rc6.

Comment 1 Raghavendra Bhat 2010-06-11 09:26:52 UTC
There is a memory-leak in sp_process_inode_ctx. This is the valgrind output reporting the leak.
279 bytes in 10 blocks are definitely lost in loss record 94 of 145
==4084==    at 0x4C24E27: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4084==    by 0x55234D1: strdup (in /lib64/libc-2.9.so)
==4084==    by 0x4E4262B: loc_copy (xlator.c:1024)
==4084==    by 0x73013AD: sp_process_inode_ctx (stat-prefetch.c:284)
==4084==    by 0x730EED3: sp_getxattr (stat-prefetch.c:3064)
==4084==    by 0x75269B7: fuse_getxattr (fuse-bridge.c:2669)
==4084==    by 0x7528C0F: fuse_thread_proc (fuse-bridge.c:3193)
==4084==    by 0x528E39F: start_thread (in /lib64/libpthread-2.9.so)
==4084==    by 0x5587BDC: clone (in /lib64/libc-2.9.so)

in sp_getxattr_cbk it should be SP_STACK_UNWIND which frees the local structure, but STACK_UNWIND is used, thus causing a leak.

Comment 2 Anand Avati 2010-06-14 08:32:17 UTC
PATCH: http://patches.gluster.com/patch/3413 in release-3.0 (free local->loc structure by using SP_STACK_UNWIND instead of STACK_UNWIND)

Comment 3 Tejas Bhise 2010-07-26 08:18:28 UTC
Raghu - is this code going in 3.1 also ?

Comment 4 Anand Avati 2010-08-21 09:17:10 UTC
PATCH: http://patches.gluster.com/patch/4227 in master (performance/stat-prefetch: use SP_STACK_UNWIND instead of STACK_UNWIND_STRICT.)