https://issues.apache.org/bugzilla/show_bug.cgi?id=56658

            Bug ID: 56658
           Summary: Concurrency issue with wrapper mappings in Mapper
           Product: Tomcat 8
           Version: 8.0.8
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: knst.koli...@gmail.com

When a context starts up, its servlet mappings are registered in a Mapper.

The issue is that MapperListener.registerContext() is implemented as

[[[
        mapper.addContextVersion(...);
        for (Container container : context.findChildren()) {
            registerWrapper((Wrapper) container);
        }
]]]

It registers a context first, then registers it wrappers.  So there is a time
slot when the Context have already been registered in the Mapper, but its
Wrappers are not yet registered there.  If a request comes it, it can be mapped
to a wrong servlet.

In CoyoteAdapter.postParseRequest there is code that protects from this issue
when a Context is being reloaded.
- An "if (request.getContext().getPaused())" check.

In case if Context is deployed on an already running server, there is no
protection.

I think the way to fix this it to amend the Mapper.addContextVersion() method
and pass wrapper mappings to it. In this case the Mapper should be create a
correct full configuration for a web application at once.

Alternatively, we may change the default value of StandardContext.paused flag
to be "true" and switch it to "false" when the context has already started up.

Alternatively, we may check Context state in CoyoteAdapter.postParseRequest.
Can this get rid of the "started" flag?

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to