Reputation: 27474
I have a long-run job on Tomcat. It's a data conversion to update the database for a new release, in case you wonder. On our development server it took 7 hours to run but completed with no problems. Every 60 seconds it sends a progress message to the browser to let you know it's still alive and keep the connection active.
Then I tried to run it on a different server and after 120 minutes it failed with an exception, "getAttribute: Session already invalidated". I restarted it and again it failed with the same message after 120 minutes. It had a feature to restart at certain key points so I started it at "part 2" and again it died at 120 minutes.
I conclude something in the server is imposing a time limit of 120 minutes -- it's too much of a coincidence for it to die due to a program bug at exactly the same elapsed time 3 times in a row, especially when the third run would have been different data.
The Tomcat <session-timeout> on our development server was set to 30, and on that server it ran 7 hours no problem, so whatever limit that's imposing, I don't think that's it.
Any clues as to what's shooting me down? I'm guessing there's another sort of timeout in there somewhere, but I don't know what it is.
Upvotes: 4
Views: 1469
Reputation: 11
From here:
org.apache.catalina.session.StandardSession.ACTIVITY_CHECK
If this is true or if org.apache.catalina.STRICT_SERVLET_COMPLIANCE is true Tomcat will track the number of active requests for each session. When determining if a session is valid, any session with at least one active request will always be considered valid.
If not specified, the default value of false will be used.
Upvotes: 1
Reputation: 87187
Could you just background the job and have it update a resource that would allow you to poll for the status instead of maintaining the connection the entire time?
You could easily do this with a Thread.
Upvotes: 3