Bug 1728047

Summary: interrupts leak memory
Product: [Community] GlusterFS Reporter: Csaba Henk <csaba>
Component: fuseAssignee: Csaba Henk <csaba>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bmekala, bugs, nbalacha
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1734423 1744874 (view as bug list) Environment:
Last Closed: 2019-11-04 04:05:34 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: 1734423, 1744874, 1753571    

Description Csaba Henk 2019-07-08 22:07:11 UTC
Description of problem:

When the glusterfs fuse client gets an INTERRUPT message (ie. a process gets SIGINT while in a syscall to the filesystem), not all data allocated by the handler code is freed.

Version-Release number of selected component (if applicable):

>= 6.0

The issue appears with the introduction of the interrupt handling framework.

How reproducible:

Always

Steps to Reproduce:
1. Compile the test helper of the tests/features/interrupt.t test, open_and_sleep.c:

  $ gcc -o open_and_sleep tests/features/open_and_sleep.c

2. Mount a glusterfs volume 
3. Run the command used in tests/features/interrupt.t in a loop against some file in the mount:

   $ while :; do ./open_and_sleep <SOME-FILE> | { sleep 0.1; xargs -n1 kill -INT; }
3. Take statedumps at regular intervals and check gf_fuse_mt_iov_base memusage:

   # grep -A5 gf_fuse_mt_iov_base <STATEDUMP>

Actual results:

Values of size and num_alloc fields monotonously grow with time across statedumps.

Expected results:

Values of size and num_alloc fields stay low across statedumps.

Comment 1 Csaba Henk 2019-07-08 22:11:10 UTC
Command in reproduction step 3. is incomplete. It should be:

  $ while :; do ./open_and_sleep <SOME-FILE> | { sleep 0.1; xargs -n1 kill -INT; }; done

Improved version which also displays a counter:

  $ i=1; while :; do echo -en "\r$i  "; ./open_and_sleep <SOME-FILE> | { sleep 0.1; xargs -n1 kill -INT; }; i=$(($i+1)); done

Comment 2 Worker Ant 2019-07-09 09:10:00 UTC
REVIEW: https://review.gluster.org/23016 (fuse: add missing GF_FREE to fuse_interrupt) posted (#1) for review on master by Csaba Henk

Comment 3 Worker Ant 2019-07-25 16:46:43 UTC
REVIEW: https://review.gluster.org/23016 (fuse: add missing GF_FREE to fuse_interrupt) merged (#4) on master by Amar Tumballi

Comment 4 Worker Ant 2019-08-22 11:13:14 UTC
REVIEW: https://review.gluster.org/23285 (fuse: add missing GF_FREE to fuse_interrupt) posted (#1) for review on release-7 by Csaba Henk

Comment 5 Worker Ant 2019-08-23 05:03:14 UTC
REVISION POSTED: https://review.gluster.org/23285 (fuse: add missing GF_FREE to fuse_interrupt) posted (#2) for review on release-7 by N Balachandran

Comment 6 Bala Konda Reddy M 2019-09-12 13:27:41 UTC
(In reply to Csaba Henk from comment #1)
> Command in reproduction step 3. is incomplete. It should be:
> 
>   $ while :; do ./open_and_sleep <SOME-FILE> | { sleep 0.1; xargs -n1 kill
> -INT; }; done
> 
> Improved version which also displays a counter:
> 
>   $ i=1; while :; do echo -en "\r$i  "; ./open_and_sleep <SOME-FILE> | {
> sleep 0.1; xargs -n1 kill -INT; }; i=$(($i+1)); done

Use the below command to run the compiled open_and_sleep.c file in a loop

i=1; while :; do echo -en "\r$i  "; (./open_and_sleep <SOME-FILE> | { sleep 0.1; xargs -n1 kill -INT; }); i=$(($i+1)); done