From nobody@FreeBSD.org  Sat Feb 25 14:33:17 2012
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 82DFC106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Feb 2012 14:33:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 6EF178FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Feb 2012 14:33:17 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q1PEXHOj050330
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 25 Feb 2012 14:33:17 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q1PEXHw4050327;
	Sat, 25 Feb 2012 14:33:17 GMT
	(envelope-from nobody)
Message-Id: <201202251433.q1PEXHw4050327@red.freebsd.org>
Date: Sat, 25 Feb 2012 14:33:17 GMT
From: Patrick Dung <patrick_dkt@yahoo.com.hk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /usr/bin/bsdgrep hang/very slow with mmap
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         165471
>Category:       bin
>Synopsis:       bsdgrep(1) hang/very slow with mmap
>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 25 14:40:14 UTC 2012
>Closed-Date:    
>Last-Modified:  Sun Sep 15 18:44:56 UTC 2013
>Originator:     Patrick Dung
>Release:        Freebsd 9.0
>Organization:
none
>Environment:
root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
bsdgrep with --mmap would sometimes cause hang/slow response.
Also it is eating memory when it is very slow/hang.

cd /usr/local/share and compare grep and bsdgrep:

[root@fbsd9-test /usr/local/share]# time grep --mmap -r -e '^Feb' *
deplate/locale/de.latin1:February
deplate/locale/de.latin1:Februar

real    0m1.875s
user    0m0.085s
sys     0m1.327s
[root@fbsd9-test /usr/local/share]# time bsdgrep --mmap -r -e '^Feb' *
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

real    1m40.931s
user    0m0.427s
sys     1m22.064s

>How-To-Repeat:
only encounter problem with some files
>Fix:
use GNU grep

>Release-Note:
>Audit-Trail:

From: Patrick Dung <patrick_dkt@yahoo.com.hk>
To: "freebsd-bugs@FreeBSD.org" <freebsd-bugs@FreeBSD.org>,
  "bug-followup@FreeBSD.org" <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: bin/165471: bsdgrep(1) hang/very slow with mmap
Date: Sun, 15 Sep 2013 15:58:48 +0800 (SGT)

 ---1392289268-1041998601-1379231928=:48545
 Content-Type: text/plain; charset=iso-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 After one and a half year, I have tried the same case on FreeBSD 9.2 RC4 x6=
 4.=0AThe result is as below. The mmap with bsdgrep option is eating memory/=
 swap and it is killed due to out of swap.=0A=0A=0A[root@server2 /usr/local/=
 share]# time grep --mmap -r -e '^Feb' *=0A=0Areal=A0=A0=A0 0m14.200s=0Auser=
 =A0=A0=A0 0m0.007s=0Asys=A0=A0=A0=A0 0m0.932s=0A[root@server2 /usr/local/sh=
 are]# time bsdgrep --mmap -r -e '^Feb' *=0AKilled: 9=0A=0Areal=A0=A0=A0 1m0=
 .474s=0Auser=A0=A0=A0 0m11.218s=0Asys=A0=A0=A0=A0 0m22.911s=0A=0Aswap_pager=
 _getswapspace(16): failed=0Aswap_pager_getswapspace(16): failed=0Aswap_page=
 r_getswapspace(16): failed=0Apid 3539 (bsdgrep), uid 0, was killed: out of =
 swap space=0A

 ---1392289268-1041998601-1379231928=:48545--
>Unformatted:
