From owner-freebsd-questions@FreeBSD.ORG Mon Dec 3 17:56:12 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 660B372D for ; Mon, 3 Dec 2012 17:56:12 +0000 (UTC) (envelope-from frank@undermydesk.org) Received: from amazone.undermydesk.org (amazone.undermydesk.org [213.211.198.100]) by mx1.freebsd.org (Postfix) with ESMTP id 142598FC0C for ; Mon, 3 Dec 2012 17:56:11 +0000 (UTC) Received: from amazone.undermydesk.org (localhost [127.0.0.1]) by amazone.undermydesk.org (Postfix) with ESMTP id 7892B287044; Mon, 3 Dec 2012 18:56:04 +0100 (CET) X-Virus-Scanned: amavisd-new at undermydesk.org Received: from amazone.undermydesk.org ([213.211.198.100]) by amazone.undermydesk.org (amazone.undermydesk.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MDzGw_j6B_nd; Mon, 3 Dec 2012 18:55:58 +0100 (CET) Received: from freppin-macbookpro-001-lan.employees.statconsult.de (port-ip-213-211-239-178.sta.reverse.mdcc-fun.de [213.211.239.178]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by amazone.undermydesk.org (Postfix) with ESMTPSA id 4A7072869E8; Mon, 3 Dec 2012 18:55:58 +0100 (CET) Message-ID: <50BCE7A9.7060107@undermydesk.org> Date: Mon, 03 Dec 2012 18:55:53 +0100 From: Frank Reppin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: long@rule.lv Subject: Re: bash pipe redirection gets stuck References: <23353.144.36.114.84.1354545315.squirrel@mail.rule.lv> In-Reply-To: <23353.144.36.114.84.1354545315.squirrel@mail.rule.lv> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2012 17:56:12 -0000 On 03.12.12 15:35, long@rule.lv wrote: [...] > I stumbled upon a problem where multiple pipe redirection occasionally get > stuck when trying to get sha256 sum of a stream. > > You can try to reproduce the problem if you have /usr/ports/shells/bash > installed (output redirection used in this command is possible only in > bash). > Create temporary test file with command: "dd if=/dev/urandom of=/tmp/file1 > bs=1k count=10" > And the command I'm using is: > /usr/local/bin/bash -c 'cat /tmp/file1 | tee >(/sbin/sha256 > > /tmp/file1.sha256) > /tmp/file1.copy' ; echo $status > > Command gets stuck about once in 20 executions. > top output when command gets stuck (irrelevant processes removed): > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 84073 HappyUser 1 52 0 17612K 2268K wait 0 0:00 0.00% bash > 84154 HappyUser 1 52 0 10084K 844K fifoow 1 0:00 0.00% tee > > And more strangely, I can reproduce this problem on 9.0-RELEASE and > 7.4-RELEASE-p6, but couldn't reproduce on 8.2-RELEASE-p4. It maybe couldn't gather more randomness from /dev/random? The random(4) manpage suggests that there's (theoretically) indeed a chance that it blocks - see the section about 'kern.random.sys.seeded'. So in fact - when you think the command gets stuck - it's probably not bash related at all. cheers, Frank Reppin -- 43rd Law of Computing: Anything that can go wr fortune: Segmentation violation -- Core dumped