From owner-freebsd-current@FreeBSD.ORG Fri Jan 28 10:47:47 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8724F1065737 for ; Fri, 28 Jan 2011 10:47:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 0303A8FC08 for ; Fri, 28 Jan 2011 10:47:46 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p0SAlggK061998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jan 2011 12:47:42 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p0SAlgq4058526; Fri, 28 Jan 2011 12:47:42 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p0SAlg3e058525; Fri, 28 Jan 2011 12:47:42 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 28 Jan 2011 12:47:42 +0200 From: Kostik Belousov To: Sergey Kandaurov Message-ID: <20110128104742.GU2518@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YVVuqqmpr1hAxwPf" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: FreeBSD Current Subject: Re: unbounded sleep on [fifoow] while open a named pipe: is it a feature? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2011 10:47:47 -0000 --YVVuqqmpr1hAxwPf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 28, 2011 at 12:43:38PM +0300, Sergey Kandaurov wrote: > Hi. >=20 > That's FreeBSD 8.1-RELEASE i386 (w/o debug). >=20 > It's observed for bash processes which end up in unbounded sleep > in [fifoow] wchan while executing the next script: >=20 > %%% > #!/usr/local/bin/bash >=20 > LOG_FACILITY=3D"local7.notice" > LOG_TOPIC_OUT=3D"$TAG-output[$$]" > LOG_TOPIC_ERR=3D"$TAG-error[$$]" >=20 > cd $WORK_DIR >=20 > exec > >(logger -p "$LOG_FACILITY" -t "$LOG_TOPIC_OUT" ) > exec 2> >(logger -p "$LOG_FACILITY" -t "$LOG_TOPIC_ERR" ) > eval exec $1 > %%% >=20 > It's used to call $1 and redirect its stdout and stderr streams > to different files. Bash implements this functionality by creating > on every execution a new named pipe stored at /var/tmp/ directory. > This script is used to run periodically from cron(8). Note, that bash > has a misfeature to not delete those named pipes. With a high creation > frequency of named pipes (several per minute) it eventually ends > up with a large number [~137000] of existing named pipes, when it > was found that a number [~44] of bash processes sleep on [fifoow], > which is guessed to be likely caused by the number of fifo pipes created. >=20 > For example, this one sleeps for about 1.5 days: > 1001 78809 78803 0 50 0 4564 1952 fifoow Is ?? 0:00.00 > /usr/local/bin/bash ./logger_wrapper.sh ./sync_overlords.pl >=20 > # procstat -f 78809 > [...] > 78809 bash 1 f - -w------ 1 0 - /var/tmp/sh-np-[= random] > [...] >=20 > # procstat -kk 78809 > PID TID COMM TDNAME KSTACK > 78809 100733 bash - mi_switch+0x12a > sleepq_switch+0xcc sleepq_catch_signals+0x5b sleepq_wait_sig+0x18 > _sleep+0x28c fifo_open+0x718 VOP_OPEN_APV+0x42 vn_open_cred+0x52b > vn_open+0x3b kern_openat+0x125 kern_open+0x35 open+0x30 syscall+0x2d3 > Xint0x80_syscall+0x20 fifoow means that pipe is opened for writing while no readers exists. --YVVuqqmpr1hAxwPf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1Cns0ACgkQC3+MBN1Mb4gHgQCeInXCnHD9Yruo73pF2Ax8lal7 +08An3udZhKNJPb+LuGhWjkjK9bKXnF1 =JKSh -----END PGP SIGNATURE----- --YVVuqqmpr1hAxwPf--