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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]