NetBSD Problem Report #51572

From www@NetBSD.org  Sat Oct 22 15:41:12 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0E14D7A1AF
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 22 Oct 2016 15:41:12 +0000 (UTC)
Message-Id: <20161022154111.1D4987A2CA@mollari.NetBSD.org>
Date: Sat, 22 Oct 2016 15:41:11 +0000 (UTC)
From: scole_mail@gmx.com
Reply-To: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Subject: systat has memory leak(s)
X-Send-Pr-Version: www-1.0

>Number:         51572
>Category:       lib
>Synopsis:       curses memory leak(s) appearing in systat
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 22 15:45:00 +0000 2016
>Closed-Date:    Mon Dec 12 08:07:14 +0000 2016
>Last-Modified:  Mon Dec 12 16:25:01 +0000 2016
>Originator:     scole_mail
>Release:        7.0.2 (and current I believe)
>Organization:
none
>Environment:
NetBSD dstar 7.0.2_PATCH NetBSD 7.0.2_PATCH (GENERIC) #0: Fri Oct 21 11:17:36 PDT 2016  scole@dstar:/home/scole/nbsd/cvs/7_0/obj/sys/arch/i386/compile/GENERIC i386
>Description:
I think systat has a memory leak issue.   It seems to keep growing in memory usage, at different rates, depending on what display is chosen.

On my i386 machine, it started out using about 3.8M, and overnight grew anywhere 9M to 75M, depending on the screen.

bufcache (19M), vmstat (9M), and ifstat (75M) were some of the displays I ran that seemed to have issues.

Anyone recommend some tools that would work to detect these types of leaks on NetBSD?

Thanks
>How-To-Repeat:
systat -w 1 vmstat
 or
systat -w 1 bufcache
 or for current only
systat -w 1 ifstat
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->jdolecek
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Sat, 22 Oct 2016 19:23:14 +0000
Responsible-Changed-Why:
I'm looking at this.


Responsible-Changed-From-To: jdolecek->bin-bug-people
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Sat, 22 Oct 2016 21:22:45 +0000
Responsible-Changed-Why:
mvprintw()/mvwprintw() are the ones leaking the memory. unfortunately don't
know libcurses enough to fix, so assigning back.


Responsible-Changed-From-To: bin-bug-people->lib-bug-people
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sun, 23 Oct 2016 19:03:16 +0000
Responsible-Changed-Why:
curses is a lib


From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51572 CVS commit: src/lib/libc/stdio
Date: Sun, 23 Oct 2016 17:01:52 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Oct 23 21:01:52 UTC 2016

 Modified Files:
 	src/lib/libc/stdio: funopen.c

 Log Message:
 PR/51572: calling funopen on each printw call is a tad excessive, but this
 is not a reason for funopen to leak. Always call the close function since we
 are indirecting through our cookie and we need to free it.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/lib/libc/stdio/funopen.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 31 Oct 2016 15:45:12 +0000
State-Changed-Why:
Does that fix all of it, or is there more?


From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org, 
	netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, dholland@NetBSD.org, 
	scole_mail@gmx.com
Cc: 
Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)
Date: Mon, 31 Oct 2016 12:38:06 -0400

 On Oct 31,  3:45pm, dholland@NetBSD.org (dholland@NetBSD.org) wrote:
 -- Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)

 | Synopsis: curses memory leak(s) appearing in systat
 | 
 | State-Changed-From-To: open->feedback
 | State-Changed-By: dholland@NetBSD.org
 | State-Changed-When: Mon, 31 Oct 2016 15:45:12 +0000
 | State-Changed-Why:
 | Does that fix all of it, or is there more?

 I don't think there is more. At least I don't see a leak.

 christos

From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: christos@zoulas.com (Christos Zoulas), dholland@NetBSD.org
Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)
Date: Mon, 31 Oct 2016 18:03:13 -0700

 christos@zoulas.com (Christos Zoulas) writes:
 >
 > I don't think there is more. At least I don't see a leak.
 >

 I ran systat on current for a couple hours today.  It didn't seem to
 leak anymore, so I'd say to close it.

 Thanks


State-Changed-From-To: feedback->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 01 Nov 2016 13:01:00 +0000
State-Changed-Why:
should get into -7


From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/51572: curses memory leak(s) appearing in systat
Date: Tue, 29 Nov 2016 10:12:32 +0000

 Could it be pulled up to -7-0 too?
 (code changed a lot since -6, unfortunately)

 port-xen/51668 is another report of the same, but much worse consequences.

From: Soren Jacobsen <snj@blef.org>
To: gnats-bugs@NetBSD.org
Cc: coypu@SDF.org
Subject: Re: lib/51572: curses memory leak(s) appearing in systat
Date: Sat, 3 Dec 2016 19:31:26 -0800

 On 11/29 10:15, coypu@SDF.ORG wrote:
 > 
 > Could it be pulled up to -7-0 too?

 Doesn't meet the criteria for netbsd-7-0 (security/critical only), but
 this is certainly a good candidate for netbsd-7.

 Soren

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, scole_mail@gmx.com
Subject: re: lib/51572: curses memory leak(s) appearing in systat
Date: Mon, 05 Dec 2016 08:00:26 +1100

 >  On 11/29 10:15, coypu@SDF.ORG wrote:
 >  > 
 >  > Could it be pulled up to -7-0 too?
 >  
 >  Doesn't meet the criteria for netbsd-7-0 (security/critical only), but
 >  this is certainly a good candidate for netbsd-7.

 if this is the reason mtr has a massive memory leak then i would
 perhaps argue that it *is* important enough.

 i left mtr running overnight and it leaked so much it eventually
 used over 30GB of VA and triggered my X server being killed, so
 it was a pretty severe end result -- it could be sshd or postfix
 or something else killed on a server, with less obviousness.

 i'll try to see if this is the problem with mtr itself.


 .mrg.

From: matthew green <mrg@eterna.com.au>
To: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, scole_mail@gmx.com, gnats-bugs@NetBSD.org,
    snj@netbsd.org
Cc: 
Subject: re: lib/51572: curses memory leak(s) appearing in systat
Date: Mon, 05 Dec 2016 08:57:27 +1100

 matthew green writes:
 > >  On 11/29 10:15, coypu@SDF.ORG wrote:
 > >  > 
 > >  > Could it be pulled up to -7-0 too?
 > >  
 > >  Doesn't meet the criteria for netbsd-7-0 (security/critical only), but
 > >  this is certainly a good candidate for netbsd-7.
 > 
 > if this is the reason mtr has a massive memory leak then i would
 > perhaps argue that it *is* important enough.
 > 
 > i left mtr running overnight and it leaked so much it eventually
 > used over 30GB of VA and triggered my X server being killed, so
 > it was a pretty severe end result -- it could be sshd or postfix
 > or something else killed on a server, with less obviousness.
 > 
 > i'll try to see if this is the problem with mtr itself.

 so - i'm pretty sure this was mtr's problem as well.  i would
 like for this fix to be considered 'critical'.

 thanks.


 .mrg.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51572 CVS commit: [netbsd-7] src/lib/libc/stdio
Date: Mon, 12 Dec 2016 07:23:47 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Mon Dec 12 07:23:47 UTC 2016

 Modified Files:
 	src/lib/libc/stdio [netbsd-7]: funopen.c

 Log Message:
 Pull up following revision(s) (requested by mrg in ticket #1303):
 	lib/libc/stdio/funopen.c: revision 1.15
 PR/51572: calling funopen on each printw call is a tad excessive, but this
 is not a reason for funopen to leak. Always call the close function since we
 are indirecting through our cookie and we need to free it.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.14.10.1 src/lib/libc/stdio/funopen.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51572 CVS commit: [netbsd-7-0] src/lib/libc/stdio
Date: Mon, 12 Dec 2016 07:25:16 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Mon Dec 12 07:25:16 UTC 2016

 Modified Files:
 	src/lib/libc/stdio [netbsd-7-0]: funopen.c

 Log Message:
 Pull up following revision(s) (requested by mrg in ticket #1303):
 	lib/libc/stdio/funopen.c: revision 1.15
 PR/51572: calling funopen on each printw call is a tad excessive, but this
 is not a reason for funopen to leak. Always call the close function since we
 are indirecting through our cookie and we need to free it.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.14.12.1 src/lib/libc/stdio/funopen.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: needs-pullups->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 12 Dec 2016 08:07:14 +0000
State-Changed-Why:
pullups complete


From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: snj@netbsd.org, christos@netbsd.org
Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)
Date: Mon, 12 Dec 2016 08:06:42 -0800

 If you haven't yet, you may want to verify with christos all the files
 needed for this fix if this is being included for 7.1.

 I thought he made changes to quite a few libcurses files around the same
 time, but I'm not sure if any of those were required for the fix.

 Thanks

From: christos@zoulas.com (Christos Zoulas)
To: scole_mail <scole_mail@gmx.com>, gnats-bugs@NetBSD.org
Cc: snj@netbsd.org
Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)
Date: Mon, 12 Dec 2016 11:22:55 -0500

 On Dec 12,  8:06am, scole_mail@gmx.com (scole_mail) wrote:
 -- Subject: Re: lib/51572 (curses memory leak(s) appearing in systat)

 | If you haven't yet, you may want to verify with christos all the files
 | needed for this fix if this is being included for 7.1.
 | 
 | I thought he made changes to quite a few libcurses files around the same
 | time, but I'm not sure if any of those were required for the fix.

 So the libc part and the terminfo parts have also been pulled up so this
 should be ok!

 christos

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.