Elankath, Tarun (Cognizant) wrote:

Hi list,

We have a long running process (all in java, not external) that is initiated from struts action class, (does a lot of file I/O, etc)

The browser apparently timesout after about 20 minutes or whereabouts, and then suddenly the process do stops bang in the middle as soon as this happens. This is quite puzzling as one expects the process to continue even if the browser timed out.


If you do not write anything to the servlet output, perhaps Tomcat is assuming some kind of connection timeout or it is somehow detecting that the remote browser has broken the connection. I guess you cannot change this behaviour.

I do know the correct solution is to make it run in the background and give constant updates to the user, however, we just need to make it work ASAP with the correct approach. We'll migrate to the background process & progress page approach soon enough.


That's correct. IMHO you should move to this approach ASAP. Otherwise, you could encounter migration problems and bugs, due to some differences in how to make thing work. Remember your thread will have to notify state changes to a listener, or publish state data for your structs action to be able to get it. You should take this into account right now, even before migration :-)

Any pointers/comments on browser (Internet Explorer), server (Tomcat) settings and Struts settings to handle long-running activities in the web-request cycle would be greatly appreciated. I did scout the web, but apart from the connectionTimeout setting in the <connector> element of tomcat, I didn't find anything much. I don't think increasing session-timeout would be of any help here.


If you have access to the servlet output from your process, you could write something to it from time to time. If, for example, you write "<html>" right at the beggining of your servlet process, you can write dummy comments like "<!-- -->". If you put these statements in the right point, you could keep the connection alive until the process finishes. If you do this, remember to do an out.flush() after the writing.

I once did something similar. I wrote an html page with two divs simulating a progress bar. My process started just before writing the </html> tag. During the process I was sending a javascript code that was updating the inner div width according to the current state of the process.

This worked for me, but it made my process code far more complex than necessary... and than maintainable :-P

Finally, I dropped that code and replaced it by a background thread approach.

Hope this helps you,
Rodrigo Ruiz

Any pointers on how to avoid the 'freeze' would also be much appreciated.

Thank you,
Tarun


------------------------------------------------------------------------


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.


Visit us at http://www.cognizant.com




------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to