Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2011 12:47:42 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Sergey Kandaurov <pluknet@gmail.com>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: unbounded sleep on [fifoow] while open a named pipe: is it a feature?
Message-ID:  <20110128104742.GU2518@deviant.kiev.zoral.com.ua>
In-Reply-To: <AANLkTinQRyEABOHfMRMJMecMKtAixzf_yRTizCJT5XsO@mail.gmail.com>
References:  <AANLkTinQRyEABOHfMRMJMecMKtAixzf_yRTizCJT5XsO@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110128104742.GU2518>