Bug 822378

Summary: Memory leak in stripe in readv
Product: [Community] GlusterFS Reporter: Alexander Bersenev <bay>
Component: stripeAssignee: shishir gowda <sgowda>
Status: CLOSED CURRENTRELEASE QA Contact: shylesh <shmohan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.2.6CC: amarts, gluster-bugs, nsathyan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-24 17:44:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 817967    

Description Alexander Bersenev 2012-05-17 08:19:51 UTC
Description of problem:
Memory leak in stripe in stripe_readv_fstat_cbk when this condition is true:
 if ((local->replies[i].op_ret <
      local->replies[i].requested_size) &&
      (local->stbuf_size > (local->offset + op_ret))) {

When iobuf is created it has reference count = 1.
After iobref_add (local->iobref, iobuf); reference count becomes 2.
After iobref_unref(local->iobref); it becomes 1 and never becomes 0.
So iobuf never deletes and this causes a memory leak.

Version-Release number of selected component (if applicable):
3.2.5 and git latest

How reproducible:
Always

Steps to Reproduce:
1. Make a files on bricks that makes this condition true
2. Read them and look on memory consumption. Outpu from top:
4618 root      20   0 1721m 1.5g 1868 S  0.0 16.2   5:41.77 glusterfs

I don't know if a condition can be true in usual environment, but when is true the memory leaks.
  
Actual results:
Memory leaks.

Expected results:
Memory doesn't leak.

Additional info:
See my proposed patch on review board: http://review.gluster.com/#change,3340

Comment 1 Anand Avati 2012-05-17 22:01:00 UTC
CHANGE: http://review.gluster.com/3340 (Fixed a memory leak in stripe translator.) merged in master by Anand Avati (avati)

Comment 2 Amar Tumballi 2012-05-31 17:08:13 UTC
tried with glusterfs-3.3.0 and no more leaks were found. Made sure that 'stripe_readv_fstat_cbk() is called by adding a gf_log() in that function for verification.