Bug 62387 - SEVERE: Exception removing session Unable to delete file
Summary: SEVERE: Exception removing session Unable to delete file
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.8
Hardware: PC All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2018-05-18 12:29 UTC by Tomcat9User
Modified: 2018-05-21 08:30 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Tomcat9User 2018-05-18 12:29:00 UTC
Trying to upgrade to the new version of tomcat 9.0.8 and usign embedded tomcat.

A call to invalidate session throws the below error

May 18, 2018 1:13:12 PM org.apache.catalina.session.PersistentManagerBase removeSession
SEVERE: Exception removing session  Unable to delete file [/home/XXXXXXX/work/Tomcat/localhost/./CD38458F0A1E23F44031D95AF3CFA7BB.session] which is no longer required
java.io.IOException: Unable to delete file [/home/XXXXXXX/work/Tomcat/localhost/./CD38458F0A1E23F44031D95AF3CFA7BB.session] which is no longer required
	at org.apache.catalina.session.FileStore.remove(FileStore.java:269)
	at org.apache.catalina.session.PersistentManagerBase.removeSession(PersistentManagerBase.java:598)
	at org.apache.catalina.session.PersistentManagerBase.remove(PersistentManagerBase.java:576)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:827)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:743)
	at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1229)
	at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:171)

This happens every time session.invalidate() is called .
is there any workaround for this issue?
Comment 1 Tomcat9User 2018-05-18 13:24:13 UTC
I have noticed that this issue is occurring only when a FileStore is configured for the PersistentManager. 
I could easily replicate the issue just by adding a FileStore.
Comment 2 Mark Thomas 2018-05-18 18:36:46 UTC
This works without any Exceptions for me with a clean build from trunk. There have been no relevant changes in this area since the 9.0.8 tag.

It looks like a permissions issue. The users list is the place to obtain further help with that.
Comment 3 Mark Thomas 2018-05-18 18:40:21 UTC
Ah. I take that back. It is a timing issue. If the session is invalidated before it is persisted then you'll see the Exception.
Comment 4 Mark Thomas 2018-05-18 19:04:40 UTC
Fixed in trunk for 9.0.9 onwards.
Comment 5 Tomcat9User 2018-05-21 05:32:04 UTC
Thanks for the quick update. When can we expect the latest version 9.0.9 to be released?
Comment 6 Mark Thomas 2018-05-21 08:30:41 UTC
9.0.x is on a roughly monthly release cycle with releases generally happening in the second week of the month.