Bug 57016 - PersistentValve deletes sessions right after it creates them
Summary: PersistentValve deletes sessions right after it creates them
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.53
Hardware: Macintosh All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-25 00:06 UTC by Matt Hauck
Modified: 2014-09-25 22:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Hauck 2014-09-25 00:06:07 UTC
PersistentValve is broken as it stands and always delete sessions right after it creates them.  

cf. the following lines in https://github.com/apache/tomcat/blob/TOMCAT_7_0_42/java/org/apache/catalina/valves/PersistentValve.java#L178-L179

  store.save(session);
  ((PersistentManager) manager).removeSuper(session);


I have setup my PersistentManager with a JDBCStore, and if I set a breakpoint between these two lines, I can see the `save` call inserts a row into the database properly, and then take one step past the `removeSuper` call, and it deletes the row from the database.

The removeSuper (used by PersistentValve) method has the following comment on it:
"Remove this Session from the active Sessions for this Manager, but not from the Store."

The implementation of remove in PersistentManagerBase has the following comment:
"Remove this Session from the active Sessions for this Manager, and from the Store."

There is clearly a break in the API here. The PersistentValve is expecting the PersistentManager.removeSuper to do one thing (which method has a comment saying it exists only for the sake of PersistentValve, btw.), but PersistentManagerBase which implements this does a different thing than expected.
Comment 1 Mark Thomas 2014-09-25 19:53:20 UTC
Thanks for the report. This is fixed in 8.0.x for 8.0.15 onwards and in 7.0.x for 7.0.56 onwards.
Comment 2 Matt Hauck 2014-09-25 22:06:07 UTC
Wow, that was fast. thanks!