From owner-freebsd-java@FreeBSD.ORG Mon Jun 27 17:38:07 2005 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2BA016A41C for ; Mon, 27 Jun 2005 17:38:07 +0000 (GMT) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out3.tiscali.nl (smtp-out3.tiscali.nl [195.241.79.178]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62B3C43D4C for ; Mon, 27 Jun 2005 17:38:07 +0000 (GMT) (envelope-from ronald-freebsd8@klop.yi.org) Received: from guido.klop.ws (unknown [82.171.39.195]) by smtp-out3.tiscali.nl (Postfix) with SMTP id A751D80110FE for ; Mon, 27 Jun 2005 19:38:01 +0200 (CEST) Received: (qmail 712 invoked from network); 27 Jun 2005 17:38:01 -0000 Received: from localhost (HELO outgoing.local) (127.0.0.1) by localhost with SMTP; 27 Jun 2005 17:38:01 -0000 Date: Mon, 27 Jun 2005 19:38:00 +0200 To: "Achilleus Mantzios" , freebsd-java@freebsd.org References: From: "Ronald Klop" Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: User-Agent: Opera M2/8.01 (FreeBSD, build 1204) Cc: Subject: Re: Wierd problem in linux 2.4.18-bf2.4, Java Blackdown-1.4.2-rc1 (Solved) X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 17:38:07 -0000 On Mon, 27 Jun 2005 11:14:14 +0200, Achilleus Mantzios wrote: > > Forgot my homework.... > A classic (lack of) consumption of output situation, > >> From the java docs: > > The Runtime.exec methods may not work well for special processes on > certain native platforms, such as native windowing processes, daemon > processes, Win16/DOS processes on Microsoft Windows, or shell scripts. > The > created subprocess does not have its own terminal or console. All its > standard io (i.e. stdin, stdout, stderr) operations will be redirected to > the parent process through three streams (Process.getOutputStream(), > Process.getInputStream(), Process.getErrorStream()). The parent process > uses these streams to feed input to and get output from the subprocess. > Because some native platforms only provide limited buffer size for > standard input and output streams, failure to promptly write the input > stream or read the output stream of the subprocess may cause the > subprocess to block, and even deadlock. > > > Sorry for the noise, the situation can pretty well > occur in FreeBSD too when pipe output buffer reaches its limit, > and at the end of the day i think someone maybe will find this > useful in the future. I always create two threads to copy the output of stdout and stderr to some place. (/dev/null or a file or System.out). In java 5 you can combine stdout and stderr, so you only need 1 thread. -- Ronald Klop Amsterdam, The Netherlands