Bug 51162 - NPE at org.apache.catalina.core.ContainerBase.removeChild()
Summary: NPE at org.apache.catalina.core.ContainerBase.removeChild()
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.32
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-06 18:56 UTC by Ondra Žižka
Modified: 2011-07-02 11:46 UTC (History)
0 users



Attachments
Additional patch for Tomcat 6 (1.07 KB, patch)
2011-06-29 14:18 UTC, Mark Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ondra Žižka 2011-05-06 18:56:08 UTC
6.5.2011 20:54:01 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/test]
6.5.2011 20:54:01 org.apache.catalina.startup.HostConfig checkResources
WARNING: Error while removing context [/test]
java.lang.NullPointerException
	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:923)
	at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1212)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1380)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
	at java.lang.Thread.run(Thread.java:662)
Comment 1 Ondra Žižka 2011-05-06 19:04:03 UTC
Steps to reproduce:

1) Get commit 

https://github.com/OndraZizka/arquillian-container-tomcat/commit/35fa744834d23c190f25d70466813fcd9e741544

2) Start Tomcat server with JMX on port 9876 (see arquillian.xml)

3) Build the tomcat6-remote-container tests
Comment 2 Mark Thomas 2011-05-09 13:08:28 UTC
Hmm. That looks like Arquillian is doing things it shouldn't and mixing auto-deployment with directly removing a Context from a Host via JMX.

I have proposed some NPE protection so Tomcat will handle this more gracefully but it looks like the root cause lies elsewhere.
Comment 3 Konstantin Kolinko 2011-05-10 06:51:50 UTC
> I have proposed some NPE protection

Regarding the proposed Tomcat 6 patch (backport of r943112):

It is good per se, for any Container.removeChild() call, but won't be enough here.

> java.lang.NullPointerException
>    at
org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:923)
>    at
org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1212)

The patch will cure the removeChild(null) call at HostConfig.java:1212, but several lines later (1218) there is context.destroy() call that will result in the same NPE. This is specific to TC6, as trunk does not call destroy() there.
Comment 4 Mark Thomas 2011-05-10 08:47:32 UTC
First patch applied. Still need to address the additional issue Konstantin identified.
Comment 5 Ondra Žižka 2011-05-12 15:06:38 UTC
Thanks.
This is part of https://issues.jboss.org/browse/ARQ-262 
I will check the undeployment method eventually.
Comment 6 Mark Thomas 2011-06-29 14:18:42 UTC
Created attachment 27228 [details]
Additional patch for Tomcat 6

This patch addresses the additional NPE identified by Konstantin.
Comment 7 Mark Thomas 2011-07-02 11:46:17 UTC
This has been fixed in 6.0.x and will be included in 6.0.33 onwards.