Project: Tomcat
Bug 47705 ArithmeticException: / by zero when expiring sessions via manager
Reported: 2009-08-19 00:12:52 | Status: resolved fixed

Received ArithmeticException: / by zero when expiring sessions via Tomcat manager webapp. This exception was thrown only if session-timeout is set as -1 on webapp web.xml. Moreover, the exception was also thrown regardless of the idle parameter value (/expire?path=/xxx&idle=mm) as long as session-timeout = -1. Result: Exception stacktrace: ERROR: 19/08/2009 00:18:22 [http-80-exec-33] (org.apache.catalina.core.ApplicationContext:669) HTMLManager: ManagerServlet.sessions[/contextpath] java.lang.ArithmeticException: / by zero at org.apache.catalina.manager.ManagerServlet.sessions(ManagerServlet.java:1133) at org.apache.catalina.manager.HTMLManagerServlet.sessions(HTMLManagerServlet.java:573) at org.apache.catalina.manager.HTMLManagerServlet.expireSessions(HTMLManagerServlet.java:660) at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:118) at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:157) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:880) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:719) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2081) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

Files changed in fix:
java/org/apache/catalina/manager/ManagerServlet.java