Re: Suspended processes

Eric Noriega <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Organization The George Washington University, Department of Computer Science
Message-ID <[email protected]>
    I'm not sure but it I would guess at one of two issues:

   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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.