Looking in the source, I note 2 "FIXME" comments -- one of which seems to clearly indicate a race condition. It actually occurs twice (though the comment only occurs once) but the code in both cases looks similar to:
// Swap out all sessions idle longer than maxIdleSwap
// FIXME: What's preventing us from mangling a session during
// a request?
if (maxIdleSwap >= 0) {
for (int i = 0; i < sessions.length; i++) {
StandardSession session = (StandardSession) sessions[i];
if (!session.isValid())
continue;
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getLastAccessedTime())
/ 1000L);
if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap) {
if (log.isDebugEnabled())
log.debug(sm.getString
("persistentManager.swapMaxIdle",
session.getId(), new Integer(timeIdle)));
try {
swapOut(session);
} catch (IOException e) {
; // This is logged in writeSession()
}
}
}
}Does anyone have any brilliant ideas/suggestions on how this condition should be resolved? I'm digging around, but my experience with all of the pieces involved is rather limited.
-- Jess Holle
