From phk@critter.freebsd.dk  Sat Feb  4 15:04:41 2012
Return-Path: <phk@critter.freebsd.dk>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC793106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Feb 2012 15:04:41 +0000 (UTC)
	(envelope-from phk@critter.freebsd.dk)
Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222])
	by mx1.freebsd.org (Postfix) with ESMTP id 83ED28FC14
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Feb 2012 15:04:41 +0000 (UTC)
Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3])
	by phk.freebsd.dk (Postfix) with ESMTP id E60175C37
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Feb 2012 15:04:39 +0000 (UTC)
Received: from critter.freebsd.dk (localhost [127.0.0.1])
	by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q14F4dNT011572
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 4 Feb 2012 15:04:39 GMT
	(envelope-from phk@critter.freebsd.dk)
Received: (from phk@localhost)
	by critter.freebsd.dk (8.14.5/8.14.5/Submit) id q14F4d0D011571;
	Sat, 4 Feb 2012 15:04:39 GMT
	(envelope-from phk)
Message-Id: <201202041504.q14F4d0D011571@critter.freebsd.dk>
Date: Sat, 4 Feb 2012 15:04:39 GMT
From: Poul-Henning Kamp <phk@critter.freebsd.dk>
Reply-To: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Memory leak in VNET
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         164763
>Category:       kern
>Synopsis:       [vnet] Memory leak in VNET
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 04 15:10:09 UTC 2012
>Closed-Date:    
>Last-Modified:  Thu May 22 21:00:02 UTC 2014
>Originator:     Poul-Henning Kamp
>Release:        FreeBSD 9.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD  9.0-STABLE FreeBSD 9.0-STABLE #2 r230977: Sat Feb  4 14:01:35 UTC 2012     root@d9:/usr/obj/nanobsd.d9/freebsd/9-stable/sys/D9KERN  i386

>Description:

	Destroying a jail with attached vnet interfaces results in UMA
	keg leakage:

	Freed UMA keg was not empty (30 items).  Lost 2 pages of memory.
	Freed UMA keg was not empty (203 items).  Lost 1 pages of memory.
	hhook_vnet_uninit: hhook_head type=1, id=1 cleanup required
	hhook_vnet_uninit: hhook_head type=1, id=0 cleanup required


>How-To-Repeat:

	ifconfig epair0 create
	jail -i -c vnet name=ext persist
	jexec ext ifconfig
	jail -r ext

>Fix:

	


>Release-Note:
>Audit-Trail:

From: MD <mark+freebsdpr@internecto.net>
To: bug-followup@FreeBSD.org, phk@critter.freebsd.dk
Cc:  
Subject: Re: kern/164763: Memory leak in VNET
Date: Wed, 9 Jan 2013 10:20:44 +0100

 Our current rule of thumb is "if you need to shutdown one vimage jail
 then you need to reboot the host."
 
 So we just shut down the services in each jail, leave the jails
 themselves up, and just reboot the host.
 
 Of course this is far from optimal. Is this PR still on the radar of
 anyone?

From: "joeb1" <joeb1@a1poweruser.com>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: kern/164763: Memory leak in VNET
Date: Fri, 2 May 2014 11:18:25 -0400

 This is still occurring 1n RELEASE 8.x, RELEASE 9.x, and RELEASE 10.0.
 

From: =?UTF-8?B?SGlyb28gT25vICjlsI/ph47lr5vnlJ8p?= <hiroo.ono+freebsd@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164763: [vimage] Memory leak in VNET
Date: Fri, 23 May 2014 00:02:36 +0900

 I tracked this issue down a little.
 
 I put some printf's and found that this occurs in the function
 vnet_destroy() in sys/net/vnet.c.
 The memory leak seems to happen when vnet_sysuninit() is called.
 So, something needs to be done before or inside vnet_sysuninit(), but
 I do not know
 what to do.
 
 The messages I saw on head and stable/10 around 2014-04-30 are:
 Freed UMA keg (udp_inpcb) was not empty (135 items). Lost 9 pages of memory.
 Freed UMA keg (udpcb) was not empty (250 items). Lost 1 pages of memory.
 Freed UMA keg (tcp_inpcb) was not empty (75 items). Lost 5 pages of memory.
 Freed UMA keg (tcpcb) was not empty (15 items). Lost 3 pages of memory.

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/164763: [vimage] Memory leak in VNET
Date: Thu, 22 May 2014 15:53:34 -0500

 ----- Forwarded message from "Bjoern A. Zeeb" <bz@FreeBSD.org> -----
 
 Date: Thu, 22 May 2014 15:16:43 +0000
 From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
 To: "Hiroo Ono (小野寛生)" <hiroo.ono+freebsd@gmail.com>
 Cc: freebsd-bugs@FreeBSD.org
 Subject: Re: kern/164763: [vimage] Memory leak in VNET
 X-Mailer: Apple Mail (2.1874)
 
 
 The fixes for UDP have been in a perforce branch for two years and need
 updating and merging into HEAD.
 
 TCP was and is the only thing that could not be completely freed (back
 two years ago) synchronously and thus would continue to leak.  It’s not
 not fixable and probably with some tw changes lately got better (or maybe
 they didn’t happen).
 
 — 
 Bjoern A. Zeeb             "Come on. Learn, goddamn it.", WarGames, 1983
 
 ----- End forwarded message -----
>Unformatted:
