Pascal,

On 12/5/24 11:04 AM, Pascal Rigaux wrote:
On 04/12/2024 18:09, Mark Thomas wrote:
The Manager/Store component can't easily determine if it is being configured from the global, host or context level context.xml file.

The root cause here is configuration error - configuring multiple web applications to use the same file for session persistence.

Thanks for the explantation!


Suggestions for StandardManager.file() :


- allowing a directory as absolute pathname:

   if (file.isAbsolute()) {
     if (file.isDirectory()) {
       var contextName = getContext().getBaseName();
       return new File(file, "SESSIONS-" + contextName + ".ser");


- a quite ugly code to detect bad usage:

     static Map<String, String> pathname2contextName = new HashMap<>();

     ...

       if (file.isAbsolute()) {
         var contextName = getContext().getBaseName();
         var prev = pathname2contextName.get(pathname);
         if (prev != null && !prev.equals(contextName)) {
          log.error("You can not share same absolute \"pathname\" for multiple <Manager>s (found same \"pathname\" for " + contextName + " and " + prev + ")");
         }
         pathname2contextName.put(pathname, contextName);

This will likely cause issues with parallel deployment.

If anything, this ought to be a non-fatal warning, and potentially under a logger used exclusively for this purpose so it can be disabled if the operator knows what they are doing.

-chris


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

Reply via email to