From owner-freebsd-questions@FreeBSD.ORG Fri Jan 11 07:32:38 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A6182768 for ; Fri, 11 Jan 2013 07:32:38 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3E06ED for ; Fri, 11 Jan 2013 07:32:38 +0000 (UTC) Received: by mail-pb0-f50.google.com with SMTP id wz7so803104pbc.9 for ; Thu, 10 Jan 2013 23:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Oxi9OTMK57UiAOJQO080qo06E/abp0aCuMxJEqYBPEM=; b=cckCggF2PtGU4hsx7Ebl/qT00c7GK8TZ/5v/O4XMp3m6lmf9m0F4WLJEcxCThN9eka JpmZagxGRhBwFf5WH/47vCMVnhcBttA3a/AcroKjqj0cqajvCRl91yGLWAFCb0qL1FCO i0fez5cAPwu8NffiPiQai6WMBzCVBiTX7yhY/7pr5jJwXJP/aRDbJNgCIVhaVhO7qiRk jKm0ZS6K9LFsutnOyLmOFqnY6bHvkLdxoJfCTAQtqTGh9+IkqaRkavq7F+YbDUjWUwZh f9pcwOItqHNNybRszAwioTG2msvPsNgOZ/+qGo6VfuCOr47vv6udADFlEZqBhux788wu Ld8Q== MIME-Version: 1.0 Received: by 10.68.189.163 with SMTP id gj3mr227212157pbc.110.1357889552832; Thu, 10 Jan 2013 23:32:32 -0800 (PST) Received: by 10.67.2.65 with HTTP; Thu, 10 Jan 2013 23:32:32 -0800 (PST) Date: Thu, 10 Jan 2013 23:32:32 -0800 Message-ID: Subject: Process hangs on large pipe writes From: Kevin Oberman To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 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: Fri, 11 Jan 2013 07:32:38 -0000 I have run into a problem after upgrading s system from 7.2 to 8.3 with a script that has worked correctly for about a decade. The script, written in perl, starts about 25 processes to gather information from a number of other systems. I create an array of filehandles, one per remote system and then open each with an ssh command: $pid = open $fh, "ssh -xa $_ 2>& 1 |" I then set up a 30 second watchdog via sigalarm that will kill any process that has not completed and exited and do a wait for each process to complete with a waitpid. (The processes normally all complete in about 2 seconds.) Each ssh command will return between about 14 and 32 KB of ASCII data, written line at a time with lines of no more than 80- characters.. On each run after the upgrade between 8 and 15 of the processes will hang and only a portion of the data will be available when I read the filehandle. Anyone have any idea what could have changed between FreeBSD 7.2 and 8.3? It looks like a bug or a new limitation on pipe operations. I don't know much about Perl internals, but I assume that no read is done on the pipe until I attempt to read the filehandle, so I believe it is some limit on writes to the pipe with no reads done. I have modified the script to write to files instead of a pipe and it is working again, but I would like to understand what broke my script. -- R. Kevin Oberman, Network Engineer E-mail: kob6558@gmail.com