Bug 59449 - org.apache.catalina.core.ContainerBase#removeChild remove order
Summary: org.apache.catalina.core.ContainerBase#removeChild remove order
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.0.M4
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-10 06:02 UTC by Huxing Zhang
Modified: 2019-06-20 08:38 UTC (History)
0 users



Attachments
patch to implement the proposed behaviour. (1.23 KB, patch)
2016-05-10 06:02 UTC, Huxing Zhang
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Huxing Zhang 2016-05-10 06:02:59 UTC
Created attachment 33832 [details]
patch to implement the proposed behaviour.

Hi, 

In org.apache.catalina.core.ContainerBase#addChildInternal,  we have the following execution order:

1. put child to children
2. call child' start
3. fire ADD_CHILD_EVENT

However, in org.apache.catalina.core.ContainerBase#removeChild, the execution order is not in reverse order:

1. remove child from children
2. call child's stop
3. fire REMOVE_CHILD_EVENT
4. call child's destroy if necessary 

This may lead to some unexpected behaviour. e.g. One can deploy a web app while it is being undeployed.

Proposed execution order  in removeChild:

1. call child's stop
2. call child's destroy if necessary 
3. remove child from children
4. fire REMOVE_CHILD_EVENT
Comment 1 Mark Thomas 2016-05-10 08:50:30 UTC
Thanks for the report and the patch.

This has been fixed in the following versions:
- 9.0.x for 9.0.0.M5
- 8.5.x for 8.5.1
- 8.0.x for 8.0.34
- 7.0.x for 7.0.70
- 6.0.x for 6.0.46