ChristopherSchultz commented on code in PR #882:
URL: https://github.com/apache/tomcat/pull/882#discussion_r2283179949


##########
java/org/apache/catalina/session/FileStore.java:
##########
@@ -217,16 +233,21 @@ public Session load(String id) throws 
ClassNotFoundException, IOException {
     @Override
     public void remove(String id) throws IOException {
         File file = file(id);
-        if (file == null) {
+        if (file == null || !file.exists()) {

Review Comment:
   > There is no actual data consumption or modification here at this point so 
it should not be sensitive to any concurrent operations for any locking 
requirements. We can just check the file existence here without locking and if 
it doesn't exist, quickly return with no further operation needed as we already 
know without locking that there will be no file to remove.
   
   I would argue that a filesystem operation is much heavier than a 
lock-acquisition. It turns out that filesystem operations are very slow, 
especially if a non-local filesystem is being used. The worst case here is, as 
usual, NFS.
   
   I'm not going to push super hard on this; I was just saying that if all the 
methods have a similar structure, it's easier to validate that they are all 
doing the same thing ... correctly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to