mutex-bug in recent releng_[67]?
Arno J. Klaassen
arno at heho.snv.jussieu.fr
Sat Nov 17 17:48:17 PST 2007
Nate Williams <nate at 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)
More information about the freebsd-java
mailing list