process deadlocks when forked using Runtime.exec()
1 posts in topic
Flat View  Flat View

Posted By:   Pallavi_Jadhav
Posted On:   Monday, June 11, 2001 11:45 AM

We have a parent java process that uses the Runtime Object's exec() method to fork another child process which is a web based rich client.

This client process makes HTTP calls to a server process on the intranet and exchanges huge amount of data to and from the server.

When run independantly the client process runs without any problem. However when forked as a child, it hangs after making first call to the server.

It sometimes goes all the way and other times, just doesnt function.

Both these processes are running on Windows NT workstation 4.0 with

Any idea why this would be happening ?

Re: process deadlocks when forked using Runtime.exec()

Posted By:   Tim_Rohaly  
Posted On:   Friday, June 15, 2001 06:07 PM

Perhaps this excerpt from the Java API docs for
java.lang.Process answers your question:

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 Win32, 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.
About | Sitemap | Contact