This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Regarding the Apache session timeout error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Regarding the Apache session timeout error" Watch "Regarding the Apache session timeout error" New topic
Author

Regarding the Apache session timeout error

J Imraan
Greenhorn

Joined: Apr 15, 2013
Posts: 4
Hello Folks,



We are executing long running DB search query between AP and DB. If search query execution takes above 300 secs then it is failing and browser disconnects the server with the error message 'Page cannot be displayed' on the browser. If the search query execution takes below 300 secs then it is not failing.

I have checked the apache and jboss logs, there are no errors.

We have increased the TransactionTimeout setting value at Jboss side from 300 to 4000. But same issue occured again. Is there any setting needs to be checked and changed at Apache side?

Could you please clarify in detail, what could be the reason for the above case?

Thanks in Advance.

Regards,
Imran
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

If you are running a process that routinely takes a long time to complete, you should not attempt to tie it directly to an HTTP request/response cycle. HTTP request handling is architected with the idea that all requests should be handled as quickly as possible.

In all likelihood, it isn't your server timing out and definitely not the session settings. Most such problems are due to timeout by the client, which figures that if there isn't a response within a certain amount of time (typically a minute or 2), then the response isn't coming back at all.

The recommended way to handle long-running processes is to build an asynchronous "engine" to do the processing. You must not do this in a request/response handler! Servlets and JSPs run under threads assigned to them from a common pool of uniform thread objects and the J2EE standard flatly forbids them to spawn child threads. Instead, you can spawn the master engine thread from a ServletContextListener at application startup time.

The engine, since it is an asynchronous service, just sits there until a request/response thread communicates with it. Typically, the communications can be either a request for the engine to process something (for example, to build a report) or to return status/progress information. Other common communications may consist of code to retrieve a finished report for transmission back to the client. All such communications should be thread-safe, since we're dealing with 2 asynchronous threads here.

Using this method, the client is never tied up and doesn't time out. A periodic page refresh (or AJAX equivalent) is often used to monitor progress and retrieve the results of the engine processing, although in some cases, the results may be emailed or returned via some other method.


Customer surveys are for companies who didn't pay proper attention to begin with.
J Imraan
Greenhorn

Joined: Apr 15, 2013
Posts: 4

Hello Tim,

Thank you very much for your suggestion. I will work as per your suggestion.
If there is any more question i will get back to you.

Regards,
Imran
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding the Apache session timeout error
 
Similar Threads
Long Query execution time
JSF scalability and performance issues... please help... important
Need help on optimizing JDBC configurations
Weblogic Timeout Attributes
Retrieving huge ResultSet in chunks