aogburn commented on code in PR #882: URL: https://github.com/apache/tomcat/pull/882#discussion_r2282736787
########## java/org/apache/catalina/session/FileStore.java: ########## @@ -243,9 +264,14 @@ public void save(Session session) throws IOException { .trace(sm.getString(getStoreName() + ".saving", session.getIdInternal(), file.getAbsolutePath())); } - try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath()); - ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos))) { - ((StandardSession) session).writeObjectData(oos); + try { + acquireIdWriteLock(session.getIdInternal()); + try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath()); Review Comment: The `save` is not consuming or removing existing data so it does not care or need to check if the file exists or not already. We just need to acquire the lock before writing any actual data to ensure we don't modify the data during a `load` operations data read. -- 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