This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 4c9d9e09b5 Fix race condition.
4c9d9e09b5 is described below
commit 4c9d9e09b5e91b2fedcb9a60f24aa23d80b7a1d8
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 1edbb67feb..c01eeecf41 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -278,12 +278,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 9f769106e7..7dfb9a7b32 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,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]