Runtime.exec() hangs.

S

Sergio

Hi everybody,

My Java application blocks in Runtime.exec() as these thread dump shows:

"main" prio=1 tid=0x804e360 nid=0x7ecc waiting on monitor
[0xbfffa000..0xbfffc564]
at java.lang.Object.wait(Native Method)
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:139)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:546)
at java.lang.Runtime.exec(Runtime.java:413)
at java.lang.Runtime.exec(Runtime.java:356)
at java.lang.Runtime.exec(Runtime.java:320)
at...

It does not seem to be a problem of exhausting the resources associated to
the process's streams (as some postings in the internet suggest). The
funny thing is that the execution of that exec only hangs when I am
executing it from within an application that I am trying to debug (if I
execute the exec outside that code, it works!). The only thing I see that
maybe could have an impact is that in my code I am launching several other
processes through Runtime.exec(...); however, these exec's do not block.

The goal of the exec is to execute "cat /proc/loadavg" to see the load of
the system at that point in the Java code. However, I don't think the
specific command is relevant.

Any ideas?

Thanks in advance,

Sergio
 
G

Gordon Beaton

The goal of the exec is to execute "cat /proc/loadavg" to see the
load of the system at that point in the Java code. However, I don't
think the specific command is relevant.

Why use cat? Can't you just open and read /proc/loadavg with a
FileReader?

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top