Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Runtime.exec() hangs.

Reply
Thread Tools

Runtime.exec() hangs.

 
 
Sergio
Guest
Posts: n/a
 
      07-15-2004
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
 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      07-15-2004
On 15 Jul 2004 13:22:14 -0700, Sergio wrote:
> 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

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments