From nobody@FreeBSD.org  Wed Apr  1 22:08:29 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC765106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Apr 2009 22:08:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id DAE9A8FC1A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Apr 2009 22:08:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n31M8TUF018689
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 1 Apr 2009 22:08:29 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n31M8TK6018668;
	Wed, 1 Apr 2009 22:08:29 GMT
	(envelope-from nobody)
Message-Id: <200904012208.n31M8TK6018668@www.freebsd.org>
Date: Wed, 1 Apr 2009 22:08:29 GMT
From: Stephen Sanders <ssanders@opnet.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dd can fill system memory
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         133286
>Category:       kern
>Synopsis:       dd can fill system memory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 01 22:10:01 UTC 2009
>Closed-Date:    
>Last-Modified:  Mon Nov 22 10:22:02 UTC 2010
>Originator:     Stephen Sanders
>Release:        6.3
>Organization:
OPNET
>Environment:
FreeBSD alt-4100-1.opnet.com 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Tue Mar 31 18:47:07 EDT 2009     root@vm6-3-64-dev.opnet.com:/root/Projects/FreeBSD/package/NPbabkernel/bld-tmp/sys/amd64/compile/NPBAB  amd64

CPU: Intel(R) Xeon(R) CPU           X5450  @ 3.00GHz (2414.49-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs

16GB RAM
3ware 9650SE-16ML
16 750GB drives
16 GB swap


>Description:
Attempting to write very large files using the following command line leads to very sluggish behavior or sometimes the system will restart itself.  Dependent on how large the file is, one may see "out of swap" in the dmesg log.

dd if=/dev/zero of=/tmp/bigFile bs=128K count=200000

vmstat shows freemem going to 0 and swapping commences.  It would appear that the file system cache is growing without bound and/or pages are not being ejected from the cache fast enough.

Adding O_DIRECT to the opens on lines 141 and 148 of /usr/src/bin/dd/dd.c will fix this problem.

>How-To-Repeat:
Run the command :

dd if=/dev/zero of=/tmp/bigFile bs=128K count=200000

One may need to use a larger count than 200000.
>Fix:

Adding O_DIRECT to the opens on lines 141 and 148 of /usr/src/bin/dd/dd.c will fix this problem.

>Release-Note:
>Audit-Trail:

From: Bruce Cran <bruce@cran.org.uk>
To: Stephen Sanders <ssanders@opnet.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/133286: dd can fill system memory
Date: Wed, 1 Apr 2009 23:25:15 +0100

 On Wed, 1 Apr 2009 22:08:29 GMT
 Stephen Sanders <ssanders@opnet.com> wrote:
 
 > dd if=/dev/zero of=/tmp/bigFile bs=128K count=200000
 
 What filesystem type is /tmp - tmpfs, ufs or md?  
 
 -- 
 Bruce Cran

From: Stephen Sanders <ssanders@opnet.com>
To: bug-followup@FreeBSD.org, ssanders@opnet.com
Cc:  
Subject: Re: misc/133286: dd can fill system memory
Date: Thu, 02 Apr 2009 09:38:42 -0400

 This is a multi-part message in MIME format.
 --------------080708090000040807020600
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 The test is done on a 6.6TB UFS file system.
 
 --------------080708090000040807020600
 Content-Type: text/x-vcard; charset=utf-8;
  name="ssanders.vcf"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="ssanders.vcf"
 
 begin:vcard
 fn:Stephen Sanders
 n:Sanders;Stephen
 org:OPNET;Coretech
 adr;dom:;;7255 Woodmont;Bethesda;MD;20814
 email;internet:ssanders@opnet.com
 title:Senior Software Engineer
 tel;work:240.497.3000 x 2237
 x-mozilla-html:TRUE
 url:http://www.opnet.com
 version:2.1
 end:vcard
 
 
 --------------080708090000040807020600--
Responsible-Changed-From-To: freebsd-bugs->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sun Feb 28 14:39:12 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133286 
Responsible-Changed-From-To: brucec->freebsd-bugs 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Mon Nov 22 10:21:08 UTC 2010 
Responsible-Changed-Why:  
Back to the pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133286 
>Unformatted:
