Skip site navigation (1)Skip section navigation (2)
Date:      18 Nov 2007 02:48:06 +0100
From:      "Arno J. Klaassen" <arno@heho.snv.jussieu.fr>
To:        Nate Williams <nate@yogotech.com>
Cc:        java@freebsd.org, current@freebsd.org
Subject:   Re: mutex-bug in recent releng_[67]?
Message-ID:  <wpmytcmii1.fsf@heho.snv.jussieu.fr>
In-Reply-To: <18239.29090.668331.584942@caddis.yogotech.com>
References:  <wpfxz497cf.fsf@heho.snv.jussieu.fr> <18239.29090.668331.584942@caddis.yogotech.com>

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

Nate Williams <nate@yogotech.com> writes:

> > I have serious problems with " Runtime.getRuntime ().exec ()" : either
> > it hangs or gives a spinning mutex running at 99% cpu.
> 
> This is a Java FAQ,

Oops. Sorry for the noise ....

> and is unrelated to FreeBSD.  This program will hang
> on any OS once you reach a certain threshold of unread output that the
> OS will block the process until something 'reads' the data.
> 
> What you need to do is once you execute the command, you need to have a
> process that reads the output from the process.

OK. I see (and most often do); but indeed I didn't in cases where I were just
interested in the exit value of the command (and then afterwards
read "proc.getErrorStream" to see what went wrong ... ).

Thank you very much for your help.

> [ .. ]
> Here is my (trivial) implementation, use it as you see fit.
> [ .. ]

Thanx! I'l try.
 
> Why it works on linux-sun-jdk15 is probably due to the fact that there
> is more stack space allocated to processes, but if you modified the
> process to generate more output ('ls -R /'), it will eventually fail.


Yop, you're right.

Best,

Arno (a bit ashamed)



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