Tomcat synchronizes the process for 120 minutes

I have a long term job at Tomcat. This is data conversion to update the database for the new version, if you are wondering. It took 7 hours on our development server, but no problem. Every 60 seconds, it sends a progress message to the browser so that you know that it is still alive, and keep in touch.

Then I tried to run it on another server, and after 120 minutes it ended with the exception: "getAttribute: Session is no longer valid." I restarted it, and again it failed with the same message after 120 minutes. He had a restart function at certain key points, so I started it on β€œpart 2” and again he died after 120 minutes.

I conclude something on the server that imposes a time limit of 120 minutes - it is too much for him to die due to a program error at the same time that has passed 3 times in a row, especially when the third run would be different data.

Tomcat <session-timeout> was installed on our development server 30, and on this server he had 7 hours without problems, so no matter what the limit is, I don’t think it is.

Any clues about what killed me? I suppose there is some kind of timeout somewhere, but I do not know what it is.

+4
source share
2 answers

Could you just complete the task and update the resource, which will allow you to poll the status, and not maintain the connection all the time?

You can easily do this with Thread.

+3
source

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 whether a session is valid, any session with at least one active request is always considered valid.

If not specified, the default value false will be used.

+1
source

Source: https://habr.com/ru/post/1344176/


All Articles