Bug 822378 - Memory leak in stripe in readv
Memory leak in stripe in readv
Product: GlusterFS
Classification: Community
Component: stripe (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: shishir gowda
Depends On:
Blocks: 817967
  Show dependency treegraph
Reported: 2012-05-17 04:19 EDT by Alexander Bersenev
Modified: 2013-12-08 20:31 EST (History)
3 users (show)

See Also:
Fixed In Version: glusterfs-3.4.0
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-24 13:44:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alexander Bersenev 2012-05-17 04:19:51 EDT
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:

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 18:01:00 EDT
CHANGE: http://review.gluster.com/3340 (Fixed a memory leak in stripe translator.) merged in master by Anand Avati (avati@redhat.com)
Comment 2 Amar Tumballi 2012-05-31 13:08:13 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.