tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35746] - session manager should be immune to system clock time changes (solution provided)
Date Sun, 01 Oct 2006 20:44:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35746>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35746





------- Additional Comments From quartz12h@yahoo.com  2006-10-01 13:44 -------
Just to clarify, I proposed 2 ways of avoiding unexpected session expiration.

a) on the looping/sleeping thread, detect time shifts and pass it along the
stackframes to whichever class wants to know. This is when the looping code know
to few about the task to perform, for example if the looping thread doesn't know
the job is to assert/expire sessions, but it can pass its knowledge of time and
time shifts. That's the piece of code.

b) the looping/sleeping thread knows it has to age sessions. Valves or filters
(whatever on service()) simply resets the age to 0.


Note that if the duration of a sleep/wait could be affected by a system time
change, rolling back time 1 hour could lock up a thread for 1 more hour. The old
way of expiring session would be just as affected because which ever thread
checks for session expiration, it also calls wait/sleep. There is no other jvm
primitive to perform such pause. Therefore, the implementation would be just as
flawed in the worst case, and fairly expiring session in the best case.

- - -

As for wait()/sleep() JLS specs (JVM spec doesn't mention it):

http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.8.1
"If this is a timed wait, an internal action removing t from m's wait set that
occurs after at least millisecs milliseconds plus nanosecs nanoseconds elapse
since the beginning of this wait action."

http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.9
"Thread.sleep causes the currently executing thread to sleep (temporarily cease
execution) for the specified duration, subject to the precision and accuracy of
system timers and schedulers."

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message