From owner-freebsd-current@FreeBSD.ORG Fri Jan 28 09:43:40 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 19393106566B for ; Fri, 28 Jan 2011 09:43:40 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id C49008FC17 for ; Fri, 28 Jan 2011 09:43:39 +0000 (UTC) Received: by qwj9 with SMTP id 9so3076142qwj.13 for ; Fri, 28 Jan 2011 01:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=Cz07PM5nid7BP9rvpjlFZtucr/9C1Xv+NpNCQtNthqE=; b=pr1nzrCCeTLV9nYKYQA/uyR3nyL/iv+6BEZAh6s1Neqd3xes3KzktZ/APRmm+RJSB1 gEquXXI1lTtq2c8GRhzE43j0mup+cN8k/IOlyFE16L5mlImF8Syp0NSWXAGZPXCVxyu9 cd4AQNEsZWKjMXYJiXLI+1RLMpNNWUEgAwJZc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HuyG6GyEUeFkoTUFhgkU62AUO2dVBqyRdau8RixJSrvNTYWjEaJC/wvCkUJ+5aXDgH F6wpaQ0l+g9g+1hk6rsW+NFgoK+fCcPqhYIt3ulnRp7XGS4UPdTiubeWxYymZBOb1quh 7SQfj4y6PxJAIrELq/FDbszSXSm917blnDwco= MIME-Version: 1.0 Received: by 10.229.248.198 with SMTP id mh6mr2610682qcb.5.1296207818819; Fri, 28 Jan 2011 01:43:38 -0800 (PST) Received: by 10.229.102.87 with HTTP; Fri, 28 Jan 2011 01:43:38 -0800 (PST) Date: Fri, 28 Jan 2011 12:43:38 +0300 Message-ID: From: Sergey Kandaurov To: FreeBSD Current Content-Type: text/plain; charset=ISO-8859-1 Subject: 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 09:43:40 -0000 Hi. That's FreeBSD 8.1-RELEASE i386 (w/o debug). It's observed for bash processes which end up in unbounded sleep in [fifoow] wchan while executing the next script: %%% #!/usr/local/bin/bash LOG_FACILITY="local7.notice" LOG_TOPIC_OUT="$TAG-output[$$]" LOG_TOPIC_ERR="$TAG-error[$$]" cd $WORK_DIR exec > >(logger -p "$LOG_FACILITY" -t "$LOG_TOPIC_OUT" ) exec 2> >(logger -p "$LOG_FACILITY" -t "$LOG_TOPIC_ERR" ) eval exec $1 %%% 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. 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 # procstat -f 78809 [...] 78809 bash 1 f - -w------ 1 0 - /var/tmp/sh-np-[random] [...] # 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 -- wbr, pluknet