Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2885

HttpListenerService start doesn't clean up if start fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 10.0.0.Alpha5
    • 8.0.0.CR1
    • Web (Undertow)
    • None

    Description

      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:

      [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
      

      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.

      Attachments

        Activity

          People

            tomazcerar Tomaž Cerar (Inactive)
            bstansbe@redhat.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: