1. You don't seem to be reading the output and stderr in the
fragment. You need to keep these channels moving, otherwise the
process will hang trying to deliver output. You could consider
setting the IO to /dev/null (or NUL:) in the script so as to
assure there is no output pending.
2. If you do start reading from these, keep in mind that the
container is usually in charge of managing threads. Since most
examples show creating threads to read and process the output,
this may be a problem. This is because the default read/write
facilities don't support non-blocking IO, you need to use the NIO
classes for that.Sam Seaver wrote:
I have a JSP web interface that runs a perl script natively using a bean:
String[] cmd ={"/home/seaver/MONSTER/monster", "-i" + getJobID(), filePath + dir + getPdbFileName()}; try{ Process proc = Runtime.getRuntime().exec(cmd); BufferedWriter output = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())); BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream())); BufferedReader error = new BufferedReader(new InputStreamReader(proc.getErrorStream())); }catch (Throwable t){ t.printStackTrace(); }
The program perl script, monster, runs fine natively, and it runs fine when activated from the web interface.
The files passed into the web interface contains records which monster parses and then inputs into a small C program. This all works fine, even with multiple records (leading to the one monster instance running the C program multiple times)
however, if a file with multiple records is passed through the web interface, after doing the first few records, the perl script just simply suspends. From the look of the output, it is almost as if it never recieves back a PID from the C program, and so it hangs.
But this only happens when i run it via the web interface, so what is happening here!?
S
_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
