glassfish
  1. glassfish
  2. GLASSFISH-18184

Win 2008. "delete-local-instance <instance_name>" created an error: com.sun.enterprise.config.serverbeans.Server : wrong number of arguments

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.1.2_b17
    • Fix Version/s: 3.1.2_b20
    • Component/s: other
    • Labels:
      None

      Description

      Win 2008 GF 3.1.2 b17. Created a cluster with two instances, started instances, then stopped a cluster and executed

      delete-local-instance <instance_name>

      That command returned the follow error:

      remote failure: Exception while deleting the configuration com.sun.enterprise.config.serverbeans.Server : wrong number of arguments
      Command delete-local-instance failed.

      This problem happened sometimes, but if it happened, all such commands return this error, until DAS will be restarted.

      I did not see this issue for previous GF 3.1.2 builds, but constantly see this issue for b17 on the different Win 2008 machines. In all cases was used JDK 1.7.0_02.

      To reproduce the issue, I've run many times these two attached scripts: setup_cl.pl, unsetup_cl.pl.

      In server.log I saw only the same error message. See bellow the debug output:

      ==================================================================================
      C:\hudson\workspace\Cluster>glassfish3\glassfish\bin\asadmin delete-local-instance my-in1
      CLASSPATH= C:\hudson\workspace\Cluster\glassfish3\glassfish\bin\..\modules\admin-cli.jar
      Commands: [delete-local-instance, my-in1]
      asadmin extension directory: C:\hudson\workspace\Cluster\glassfish3\glassfish\lib\asadmin
      Prepare
      Process program options
      Parsing program options
      Parse command options
      params: {}
      operands: [my-in1]
      Prevalidate command options
      Inject command options
      Validate command options
      nodeDirChild: C:\hudson\workspace\Cluster\glassfish3\glassfish\nodes\localhost-domain1
      instanceDir: C:\hudson\workspace\Cluster\glassfish3\glassfish\nodes\localhost-domain1\my-in1
      asadmin --host localhost --port 4848 --interactive=true --echo=false --terse=false delete-local-instance my-in1
      Execute command
      Prepare
      Parsing program options
      URI: /__asadmin/uptime?Xhelp=true
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@21f4c81c
      URL: http://localhost:4848/__asadmin/uptime?Xhelp=true
      Password options: null
      Using auth info: User: null, Password: <null>
      Response Content-Type: text/xml
      ------- RAW METADATA RESPONSE ---------
      <?xml version="1.0" encoding="UTF-8" standalone="no"?><action-report description="uptime help" exit-code="SUCCESS"><message-part message=""><property name="Gene
      ratedHelp" value="true"/><command name="uptime"><option default="false" name="milliseconds" optional="true" type="BOOLEAN"/></command></message-part></action-re
      port>
      ------- RAW METADATA RESPONSE ---------
      fetchCommandModel: got command opts: com.sun.enterprise.admin.util.CommandModelData@caad9a
      doHttpCommand succeeds
      Process program options
      Parsing program options
      Parse command options
      params: {milliseconds: [true]
      }
      operands: []
      Prevalidate command options
      Inject command options
      Validate command options
      asadmin --host localhost --port 4848 --interactive=true --echo=false --terse=false uptime --milliseconds=true
      Execute command
      doUpload set to false
      URI: /__asadmin/uptime?milliseconds=true
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@6a13a848
      URL: http://localhost:4848/__asadmin/uptime?milliseconds=true
      Password options: null
      Using auth info: User: null, Password: <null>
      ------- RAW RESPONSE ---------
      Signature-Version: 1.0
      message: 318834
      milliseconds_value: 318834
      keys: milliseconds
      milliseconds_name: milliseconds
      use-main-children-attribute: false
      exit-code: SUCCESS

      ------- RAW RESPONSE ---------
      PROCESSING MANIFEST...
      doHttpCommand succeeds
      server uptime: 318834
      Prepare
      Parsing program options
      URI: /__asadmin/get?Xhelp=true
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@2d14a694
      URL: http://localhost:4848/__asadmin/get?Xhelp=true
      Password options: null
      Using auth info: User: null, Password: <null>
      Response Content-Type: text/xml
      ------- RAW METADATA RESPONSE ---------
      <?xml version="1.0" encoding="UTF-8" standalone="no"?><action-report description="get help" exit-code="SUCCESS"><message-part message=""><property name="Generat
      edHelp" value="true"/><command name="get"><option default="false" name="monitor" optional="true" short="m" type="BOOLEAN"/><operand max="1" min="1" name="patter
      n" type="STRING"/></command></message-part></action-report>
      ------- RAW METADATA RESPONSE ---------
      fetchCommandModel: got command opts: com.sun.enterprise.admin.util.CommandModelData@26c455ab
      doHttpCommand succeeds
      Process program options
      Parsing program options
      Parse command options
      params: {}
      operands: [servers.server.my-in1]
      Prevalidate command options
      Inject command options
      Validate command options
      asadmin --host localhost --port 4848 --interactive=true --echo=false --terse=false get --monitor=false servers.server.my-in1
      Execute command
      doUpload set to false
      URI: /__asadmin/get?DEFAULT=servers.server.my-in1
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@23d4616f
      URL: http://localhost:4848/__asadmin/get?DEFAULT=servers.server.my-in1
      Password options: null
      Using auth info: User: null, Password: <null>
      ------- RAW RESPONSE ---------
      Signature-Version: 1.0
      message:
      children: servers.server.my-in1.config-ref=my-c1-config;servers.server
      .my-in1.lb-weight=100;servers.server.my-in1.name=my-in1;servers.serve
      r.my-in1.node-ref=localhost-domain1
      use-main-children-attribute: true
      children-type: null
      exit-code: SUCCESS

      Name: servers.server.my-in1.node-ref=localhost-domain1
      message:

      Name: servers.server.my-in1.name=my-in1
      message:

      Name: servers.server.my-in1.lb-weight=100
      message:

      Name: servers.server.my-in1.config-ref=my-c1-config
      message:

      ------- RAW RESPONSE ---------
      PROCESSING MANIFEST...
      doHttpCommand succeeds
      Prepare
      Parsing program options
      URI: /__asadmin/_unregister-instance?Xhelp=true
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@4c48d0c9
      URL: http://localhost:4848/__asadmin/_unregister-instance?Xhelp=true
      Password options: null
      Using auth info: User: null, Password: <null>
      Response Content-Type: text/xml
      ------- RAW METADATA RESPONSE ---------
      <?xml version="1.0" encoding="UTF-8" standalone="no"?><action-report description="_unregister-instance help" exit-code="SUCCESS"><message-part message=""><prope
      rty name="GeneratedHelp" value="true"/><command name="_unregister-instance"><option name="node" optional="true" type="STRING"/><option name="target" optional="t
      rue" type="STRING"/><operand max="1" min="1" name="name" type="STRING"/></command></message-part></action-report>
      ------- RAW METADATA RESPONSE ---------
      fetchCommandModel: got command opts: com.sun.enterprise.admin.util.CommandModelData@4083633f
      doHttpCommand succeeds
      Process program options
      Parsing program options
      Parse command options
      params: {node: [localhost-domain1]
      }
      operands: [my-in1]
      Prevalidate command options
      Inject command options
      Validate command options
      asadmin --host localhost --port 4848 --interactive=true --echo=false --terse=false _unregister-instance --node localhost-domain1 my-in1
      Execute command
      doUpload set to false
      URI: /__asadmin/_unregister-instance?node=localhost-domain1&DEFAULT=my-in1
      URL: com.sun.enterprise.admin.util.HttpConnectorAddress@71e8de2f
      URL: http://localhost:4848/__asadmin/_unregister-instance?node=localhost-domain1&DEFAULT=my-in1
      Password options: null
      Using auth info: User: null, Password: <null>
      ------- RAW RESPONSE ---------
      Signature-Version: 1.0
      message: Exception while deleting the configuration com.sun.enterprise
      .config.serverbeans.Server : wrong number of arguments
      use-main-children-attribute: false
      exit-code: FAILURE

      ------- RAW RESPONSE ---------
      PROCESSING MANIFEST...
      remote failure: Exception while deleting the configuration com.sun.enterprise.config.serverbeans.Server : wrong number of arguments
      Command delete-local-instance failed.

      1. setup_cl.pl
        1.0 kB
        easarina
      2. unsetup_cl.pl
        0.4 kB
        easarina

        Activity

        easarina created issue -
        Hide
        easarina added a comment -

        If between instance creation and instance deleting many other commands were executed, then, with a big probability, this problem will be seen. At least, when I've executed an automated test, the problem was seen in 4 executions from 5 executions totally. And I did not see this issue for the previous builds.

        Show
        easarina added a comment - If between instance creation and instance deleting many other commands were executed, then, with a big probability, this problem will be seen. At least, when I've executed an automated test, the problem was seen in 4 executions from 5 executions totally. And I did not see this issue for the previous builds.
        easarina made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Critical [ 2 ]
        Hide
        Tom Mueller added a comment -

        What other commands?

        Show
        Tom Mueller added a comment - What other commands?
        Hide
        easarina added a comment -

        There were a lot of the different commands. But I was able to reproduce the issue just using create and delete instance commands, see the attached scripts.

        Show
        easarina added a comment - There were a lot of the different commands. But I was able to reproduce the issue just using create and delete instance commands, see the attached scripts.
        Hide
        Tom Mueller added a comment -

        The root cause of this issue is in the HK2 ConfigSupport._deleteChild method.

        This method has the following code:

             for (Method m : parentProxyType.getMethods()) {
                 final Class returnType = m.getReturnType();
                 if (Collection.class.isAssignableFrom(returnType)) {
                      // this could be it...
                      if (!(m.getGenericReturnType() instanceof ParameterizedType))
                             throw new IllegalArgumentException("List needs to be parameterized");
                      final Class itemType = Types.erasure(Types.getTypeArgument(m.getGenericReturnType(), 0));
                      if (itemType.isAssignableFrom(childType)) {
        

        Given a childType such as Server, this code is looking for a method such as:

            List<Server> getServer()
        

        However, the Servers config bean, which is being operated on in this case, has more than one method that returns List<Server>

        interface Servers ... {
            public List<Server> getServer();
            public List<Server> getServersOnNode(Node node);
        }
        

        If the loop encounters the 2nd method first, an "IllegalArgumentException: wrong number of arguments" is thrown because the code try to invoke the method with no arguments but getServersOnNode takes one argument. If the loop encounters the 1st method first, then it works fine.

        Suggested fix: add a check to the loop to make sure the found method takes the expected number of parameters (0).

        Show
        Tom Mueller added a comment - The root cause of this issue is in the HK2 ConfigSupport._deleteChild method. This method has the following code: for (Method m : parentProxyType.getMethods()) { final Class returnType = m.getReturnType(); if (Collection.class.isAssignableFrom(returnType)) { // this could be it... if (!(m.getGenericReturnType() instanceof ParameterizedType)) throw new IllegalArgumentException( "List needs to be parameterized" ); final Class itemType = Types.erasure(Types.getTypeArgument(m.getGenericReturnType(), 0)); if (itemType.isAssignableFrom(childType)) { Given a childType such as Server, this code is looking for a method such as: List<Server> getServer() However, the Servers config bean, which is being operated on in this case, has more than one method that returns List<Server> interface Servers ... { public List<Server> getServer(); public List<Server> getServersOnNode(Node node); } If the loop encounters the 2nd method first, an "IllegalArgumentException: wrong number of arguments" is thrown because the code try to invoke the method with no arguments but getServersOnNode takes one argument. If the loop encounters the 1st method first, then it works fine. Suggested fix: add a check to the loop to make sure the found method takes the expected number of parameters (0).
        Hide
        Tom Mueller added a comment -

        Assigning to Mahesh since this is an HK2 problem.

        The bug is in the HK2 config module, in the ConfigSupport.java file at about line 792. To fix the bug, a check has to be added to see if m.getParameterTypes().length == 0.

        To reproduce the problem, you have to run the script about 10-20 times.

        Show
        Tom Mueller added a comment - Assigning to Mahesh since this is an HK2 problem. The bug is in the HK2 config module, in the ConfigSupport.java file at about line 792. To fix the bug, a check has to be added to see if m.getParameterTypes().length == 0. To reproduce the problem, you have to run the script about 10-20 times.
        Tom Mueller made changes -
        Assignee Tom Mueller [ tmueller ] Mahesh Kannan [ mk111283 ]
        Component/s other [ 10611 ]
        Component/s admin [ 10589 ]
        scatari made changes -
        Tags 3_1_2_qa 3_1_2-review 3_1_2_qa
        Hide
        Mahesh Kannan added a comment -

        svn diff
        Index: config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java
        ===================================================================
        — config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java (revision 2533)
        +++ config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java (working copy)
        @@ -787,7 +787,7 @@
        // type will not work.
        for (Method m : parentProxyType.getMethods()) {
        final Class returnType = m.getReturnType();

        • if (Collection.class.isAssignableFrom(returnType)) {
          + if (Collection.class.isAssignableFrom(returnType) && (m.getParameterTypes().length == 0)) {
          // this could be it...
          if (!(m.getGenericReturnType() instanceof ParameterizedType))
          throw new IllegalArgumentException("List needs to be parameterized");

        svn commit -m "Fix for 18184. Admin/cli tests passed. Approved by Joe Di Pol, Reviewed by Tom Muller"
        Sending config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java
        Transmitting file data .
        Committed revision 2539.

        Approved by: Joe Di Pol

        What is the impact on the customer of the bug?
        This problem happened sometimes, but if it happened, all such commands return this error, until DAS will be restarted.

        What is the cost/risk of fixing the bug?
        Not much. Touched one file and one line

        Is there an impact on documentation or message strings?
        Not for documentation.

        Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
        The one listed in the bug report itself

        Which is the targeted build of 3.1.2 for this fix?
        3_1_2_b20

        Show
        Mahesh Kannan added a comment - svn diff Index: config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java =================================================================== — config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java (revision 2533) +++ config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java (working copy) @@ -787,7 +787,7 @@ // type will not work. for (Method m : parentProxyType.getMethods()) { final Class returnType = m.getReturnType(); if (Collection.class.isAssignableFrom(returnType)) { + if (Collection.class.isAssignableFrom(returnType) && (m.getParameterTypes().length == 0)) { // this could be it... if (!(m.getGenericReturnType() instanceof ParameterizedType)) throw new IllegalArgumentException("List needs to be parameterized"); svn commit -m "Fix for 18184. Admin/cli tests passed. Approved by Joe Di Pol, Reviewed by Tom Muller" Sending config/src/main/java/org/jvnet/hk2/config/ConfigSupport.java Transmitting file data . Committed revision 2539. Approved by: Joe Di Pol What is the impact on the customer of the bug? This problem happened sometimes, but if it happened, all such commands return this error, until DAS will be restarted. What is the cost/risk of fixing the bug? Not much. Touched one file and one line Is there an impact on documentation or message strings? Not for documentation. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? The one listed in the bug report itself Which is the targeted build of 3.1.2 for this fix? 3_1_2_b20
        Mahesh Kannan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.1.2_b20 [ 15486 ]
        Resolution Fixed [ 1 ]
        Hide
        Mahesh Kannan added a comment -

        Integrated new HK2 version

        svn commit -m "Integrate new hk2 version (fix for 18184). Approved by Joe. QL Passed"
        Sending pom.xml
        Transmitting file data .
        Committed revision 52356.

        Show
        Mahesh Kannan added a comment - Integrated new HK2 version svn commit -m "Integrate new hk2 version (fix for 18184). Approved by Joe. QL Passed" Sending pom.xml Transmitting file data . Committed revision 52356.

          People

          • Assignee:
            Mahesh Kannan
            Reporter:
            easarina
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: