https://issues.apache.org/bugzilla/show_bug.cgi?id=56712
Bug ID: 56712 Summary: Off-by-one second errors in time calculations in PersistenceManager Product: Tomcat 8 Version: 8.0.9 Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: knst.koli...@gmail.com The fix for bug 56698 (r1608443, r1608448) implemented an automated test for PersistenceManager. Reviewing the manager code to investigate the test failures, I see two issues: Checks that evaluate idle time of a session in PersistenceManagerBase typically do the following: > int timeIdle = (int) (session.getIdleTime() / 1000L); > if (timeIdle > maxIdleBackup) { ... } I see two errors in those two lines: Error 1. ---- The integer division performs truncation. Comparing the code with documentation, the condition there shall be > if (timeIdle >= maxIdleBackup) { ... } It does no matter much for a real-world configuration where the times are expected to be tens of seconds, but it matters for the test case that wants to run fast. Error 2. ---- StandardSession.getIdleTime() performs a validity check and can throw an ISE which is unexpected here. It shall be replaced with a call to session.getIdleTimeInternal(). -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org