wood burning stoves 2.0*
The moose likes Servlets and the fly likes Servlet response seems to time out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet response seems to time out" Watch "Servlet response seems to time out" New topic
Author

Servlet response seems to time out

Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Running servlets under Jetty.

After uploading a file through JSP, lengthy processing occurs. After an hour, I get the "Internet Explorer cannot display the webpage" displayed. Always exactly an hour after the processing starts. So, I"m pretty sure this is some kind of timeout issue, just not sure where (JVM? jetty? IE? VPN?). I've looked into all the various maxIdleTime settings, etc. in the configuration files that could be the culprit and none are set to an hour (or equivalent seconds/milliseconds).

I've tried turning off the 'friendly HTTP error' setting in IE to get back more info, but still get the same error.

I've also been doing quite a bit of googling and have now ended up here...

Any ideas what default timeout I may be hitting with this?

Any ways, using the HttpServletResponse object, or javascript code to somehow appear not idle, so this timeout doesn't occur?

Any ideas/suggestions are welcome..

thanks,
Tom
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
PS: The servlet continues to process in the background, the issue is that the browser returns an error after the 60 minute interval.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Browsers weren't meant to hold connections for a long time.

If your task is going to take a long time (more than 15 seconds) it's better to spawn a new thread for that task, and return right away to a page that can check the status of the process. It's also nice, when doing this, to send an email to the user when the process is done so they don't need to keep their browser open for an hour just to be able to retrieve the task's results.

I have an example application on my site that shows how to do this.
http://simple.souther.us/not-so-simple.html
Look for long running process.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Thanks, I'll look into that code. Unfortunately, sending off an email is not an option.

I'd been floating the idea about performing long-running tasks like these in the background, where the user can go to a page and check on what's running, what's queued up, etc - but the client's not set up for that currently.

At the moment, I think I need some kind of hack so that the browser doesn't time out like it does.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The only hack I know of is to keep sending packets to the browser so it knows that the response is still active.
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Ok, thanks.

Any ideas on where this hour limit that I'm hitting is coming from? I guess the browser?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yep,
Browsers will kill connections that they think are dead.
Your session on the server side could also time out if no requests come in while all of this is taking place.

The default session timeout for most servers is 30 minutes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet response seems to time out