This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new e73d1505e4 Fix race condition.
e73d1505e4 is described below
commit e73d1505e4853b4f6b638423fbeaf9c253d77802
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 10 14:25:23 2025 +0100
Fix race condition.
---
java/org/apache/catalina/session/FileStore.java | 4 ++--
webapps/docs/changelog.xml | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/session/FileStore.java
b/java/org/apache/catalina/session/FileStore.java
index 4fc202a6fc..5685229cdd 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -277,12 +277,12 @@ public final class FileStore extends StoreBase {
* Return a File object representing the pathname to our session
persistence directory, if any. The directory will
* be created if it does not already exist.
*/
- private File directory() throws IOException {
+ private synchronized File directory() throws IOException {
+ // Synchronised to avoid concurrent attempts to create the directory.
if (this.directory == null) {
return null;
}
if (this.directoryFile != null) {
- // NOTE: Race condition is harmless, so do not synchronize
return this.directoryFile;
}
File file = new File(this.directory);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f56c987688..45d9826284 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -135,6 +135,10 @@
entries are fully clean-up on session expiration. Patch provided by Kim
Johan Andersson. (markt)
</fix>
+ <fix>
+ Fix a race condition in the creation of the storage location for the
+ <code>FileStore</code>. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]