Re: Persistence of process thread despite re-loading browser

Sam Seaver <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
That didnt worked, but I think it's something to do with caching for sure.

I wrote a little line in the perl script Im running, to 'touch' a file
somewhere. This would let me know, without seeing the output streams from
the perl script, if it did actually run!

The short answer is YES!

So this means that I am actually running the perl script every time i
resubmit a query in the browser, however after the first time, the script
fails suddenly with no warning or anything, it just leaves that little
touched file to indicate that it did start running!

I have my suspicions that, within the perl script, because I actually
redirect the stderr and stdout for the duration of the script, this leads to
some kind of blocking...

start of script:

open SAVEERR, ">&STDERR";
open SAVEOUT, ">&STDOUT";
$|=1;
....

close STDERR;
open STDERR, ">&main::SAVEERR";
close STDOUT;
open STDOUT, ">&main::SAVEOUT";

end of script:


is this anything to do with it?

thanks
S
>
>Sounds like the JSP page is being cached somewhere (browser, proxty etc),
>which will prevent the code from running on the second request. Set the
>following headers to prevent this:
>
>              response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>              response.setHeader("Pragma","no-cache"); //HTTP 1.0
>              response.setDateHeader ("Expires", 0); //prevents caching at
>the proxy server
>
>Cheers
>Adrian
>
>
>
> > -----Original Message-----
> > From: Sam Seaver [SMTP:[email protected]]
> > Sent: 14 April 2003 06:38
> > To:   [email protected]
> > Subject:      Persistence of process thread despite re-loading browser
> >
> > Dear all,
> >
> > I have this code in a bean:
> >
> >
> > public void doMonster(){
> >         String[] cmd ={"/home/seaver/MONSTER/monster", "-i" + jobID,
> > filePath + dir
> > + pdbFileName};
> >
> >
> >         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()));
> >
> >
> >             output.close();
> >             input.close();
> >             error.close();
> >         }catch (Throwable t){
> >             t.printStackTrace();
> >         }
> >     }
> >
> > I have a JSP page that simply runs doMonster, the bean's parameters are
> > already in the bean, and the first time, monster runs very well.
> >
> > However, if I keep the browser window open, and even if I restart
>Tomcat,
> > when I try to run monster from the JSP page again, it does not run!  The
> > JSP
> > page creates the directory for the output files, but still, monster
>itself
> > actually doesn't execute.
> >
> > I've been browsing through the web, and I've read somewhere that if a
> > servlet starts an external thread, then that thread itself will persist
> > even
> > if the servlet is reloaded.  Is this true?
> >
> > If is I can see that I need to actually find this thread and kill it.
>For
> > even if monster itself has finished running, the process wont run again.
> > It
> > takes a few restarts of tomcat and reloading of the browser before i can
> > get
> > monster to run again, and I'm sure it's something to do with thread
> > persistence.
> >
> > Does anyone have any insight?
> > Thanks
> > Sam
> >
> > _________________________________________________________________
> > Add photos to your messages with MSN 8. Get 2 months FREE*.
> > http://join.msn.com/?page=features/featuredemail
> >
> >
>__________________________________________________________________________
> > _
> > 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
>--
>
>It is the strict policy of Truworths that its e-mail facility and all
>e-mail communications emanating therefrom, should be utilised for
>business purposes only and should conform to high professional and
>business standards.   Truworths has stipulated certain regulations in
>terms whereof strict guidelines relating to the use and content of
>e-mail communications are laid down. The use of the Truworths e-mail
>facility is not permitted for the distribution of chain letters or
>offensive mail of any nature whatsoever.   Truworths hereby distances
>itself from and accepts no liability in respect of the unauthorised
>use of its e-mail facility or the sending of e-mail communications
>for other than strictly business purposes.   Truworths furthermore
>disclaims liability for any  unauthorised instruction for  which
>permission was not granted.    Truworths Limited accepts no liability
>for any consequences arising from or as a result of reliance on this
>message unless it is in respect of bona fide Truworths business for
>which proper authorisation has been granted.
>
>Any recipient of an unacceptable communication, a chain letter or
>offensive material of any nature is requested to notify the Truworths
>e-mail administrator ([email protected]) immediately in order that
>appropriate action can be taken against the individual concerned.
>
>___________________________________________________________________________
>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
>


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail

___________________________________________________________________________
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.