glassfish
  1. glassfish
  2. GLASSFISH-20691

CPU usage increases when an invalid value is set for http lister port

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Windows 7
      Glassfish 4.0
      JDK 7

      Description

      CPU usage increases and TimeoutException occurs when -1 is set for http lister port.

      Follow this step to reproduce the problem.

      1. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1

      2. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=28282

      3. asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1

      It takes a while to complete 3 and the TimeoutException is written in the server.log. I also confirmed CPU usage increases when 3. is executed.

      [2013-07-10T14:38:01.522+1000] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=61 _ThreadName=pool-12-thread-1] [timeMillis: 1373431081522] [levelValue: 1000] [[
        Config Listener class com.sun.enterprise.v3.services.impl.DynamicConfigListener notification took too long
      java.util.concurrent.TimeoutException
      	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258)
      	at java.util.concurrent.FutureTask.get(FutureTask.java:119)
      	at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:289)
      	at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:268)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:167)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:722)
      ]]
      

        Activity

        tak09 created issue -
        Shing Wai Chan made changes -
        Field Original Value New Value
        Assignee michael.y.chen [ michael.y.chen ] Shing Wai Chan [ swchan2 ]
        Component/s web_container [ 10622 ]
        Hide
        Shing Wai Chan added a comment -

        I can see the above issue even before WebContainer starts.
        The TimeoutException is from HK2 layer.
        All ports in Grizzly NetworkListener, etc are of datatype=Integer.class. It should be a positive integer here. PositiveInteger is in nucleus/admin/config-api which is not a dependencies of nucleus/grizzly/config.

        Show
        Shing Wai Chan added a comment - I can see the above issue even before WebContainer starts. The TimeoutException is from HK2 layer. All ports in Grizzly NetworkListener, etc are of datatype=Integer.class. It should be a positive integer here. PositiveInteger is in nucleus/admin/config-api which is not a dependencies of nucleus/grizzly/config.
        Hide
        Shing Wai Chan added a comment -

        Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java
        Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
        Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java
        Transmitting file data ...
        Committed revision 62335.

        The port should be in the range from 0 (any) to 65536.
        If we set it to -1, then an error is thrown as follows:

        asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1
        remote failure: Could not change the attributes: Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ]
        Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ]
        Command set failed.

        Show
        Shing Wai Chan added a comment - Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java Transmitting file data ... Committed revision 62335. The port should be in the range from 0 (any) to 65536. If we set it to -1, then an error is thrown as follows: asadmin set server.network-config.network-listeners.network-listener.http-listener-1.port=-1 remote failure: Could not change the attributes: Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ] Constraints for this NetworkListener configuration have been violated: on property [ port ] violation reason [ must be greater than or equal to 0 ] Command set failed.
        Shing Wai Chan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Shing Wai Chan added a comment -

        Additional fix for handling the -1 default for the port of HttpRedirect.

        Sending src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
        Transmitting file data .
        Committed revision 62345.

        Show
        Shing Wai Chan added a comment - Additional fix for handling the -1 default for the port of HttpRedirect. Sending src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java Transmitting file data . Committed revision 62345.
        Hide
        Shing Wai Chan added a comment -

        Revert the previous fix using bean validation. There are devtests failures due to templating.
        Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java
        Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java
        Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java
        Transmitting file data ...
        Committed revision 62346.

        Show
        Shing Wai Chan added a comment - Revert the previous fix using bean validation. There are devtests failures due to templating. Sending config/src/main/java/org/glassfish/grizzly/config/dom/Http.java Sending config/src/main/java/org/glassfish/grizzly/config/dom/HttpRedirect.java Sending config/src/main/java/org/glassfish/grizzly/config/dom/NetworkListener.java Transmitting file data ... Committed revision 62346.
        Shing Wai Chan made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Shing Wai Chan added a comment -

        The previous fix using @Min, @Max is not working as there is $

        {...}

        pattern substitution in domain.xml.
        I am working on a fix using bean validation with constraint validator.

        Show
        Shing Wai Chan added a comment - The previous fix using @Min, @Max is not working as there is $ {...} pattern substitution in domain.xml. I am working on a fix using bean validation with constraint validator.
        Hide
        Shing Wai Chan added a comment -

        Sending dom/Http.java
        Sending dom/HttpRedirect.java
        Sending dom/NetworkListener.java
        Adding dom/Range.java
        Adding dom/RangeValidator.java
        Transmitting file data .....
        Committed revision 62347.

        Show
        Shing Wai Chan added a comment - Sending dom/Http.java Sending dom/HttpRedirect.java Sending dom/NetworkListener.java Adding dom/Range.java Adding dom/RangeValidator.java Transmitting file data ..... Committed revision 62347.
        Shing Wai Chan made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            tak09
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: