]
Tomaz Cerar updated WFLY-2885:
------------------------------
Fix Version/s: 10.0.0.Alpha5
HttpListenerService start doesn't clean up if start fails
---------------------------------------------------------
Key: WFLY-2885
URL:
https://issues.jboss.org/browse/WFLY-2885
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Affects Versions: 8.0.0.CR1
Reporter: Brian Stansberry
Assignee: Tomaz Cerar
Fix For: 10.0.0.Alpha5
HttpListenerService.prestart() does some registration stuff that doesn't get cleaned
up if start() fails later on.
I noticed this in the logs while debugging RolloutPlanTestCase failures on JDK8. Probably
unrelated to those failures; just an FYI to give context.
What happens in the test is it does an http-listener=xxx:add that is deliberately meant
to fail in Stage.RUNTIME (due to a port conflict.) Later on the test does the same thing
again. It's meant to fail there too, but I noticed in the logs that it failed for the
*wrong reason*, before the port conflict:
{code}
[Server:main-one] 10:13:44,128 ERROR [org.jboss.msc.service.fail] (MSC service thread
1-3) MSC000001: Failed to start service jboss.undertow.listener.maxFailOnePlan:
org.jboss.msc.service.StartException in service jboss.undertow.listener.maxFailOnePlan:
Failed to start service
[Server:main-one] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
[jboss-msc-1.2.0.Final.jar:1.2.0.Final]
[Server:main-one] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0]
[Server:main-one] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0]
[Server:main-one] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
[Server:main-one] Caused by: java.lang.IllegalArgumentException: UT000053: Listener
maxFailOnePlan already registered
[Server:main-one] at
io.undertow.server.ListenerRegistry.addListener(ListenerRegistry.java:32)
[undertow-core-1.0.0.CR5.jar:1.0.0.CR5]
[Server:main-one] at
org.wildfly.extension.undertow.HttpListenerService.preStart(HttpListenerService.java:107)
[Server:main-one] at
org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:121)
[Server:main-one] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
[jboss-msc-1.2.0.Final.jar:1.2.0.Final]
[Server:main-one] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
[jboss-msc-1.2.0.Final.jar:1.2.0.Final]
[Server:main-one] ... 3 more
{code}
The error ^^^ will continue to happen until the server is restarted, even if the port
conflict situation was fixed. It's because the ListenerRegistry.addListener call from
the first attempt was never cleaned up.
Cleaning up would have to be done in a catch block in ListenerService.start(). The code
in stop() that normally does the cleanup does not get called if service start has failed.
I expect we have this kind of problem in many places in the WF code.