2 Replies Latest reply on Jul 17, 2006 10:19 AM by Adrian Brock

    Nulling properties on uninstall

    Scott Stark Master

      I just saw that on a failed installation, the mc is nulling out previously set properties as part of the uninstall process. I'm not expecting this so an NPE is resulting:

      40250 TRACE [AbstractKernelController] Uninstalling VFSDeploymentScanner from Create
      40250 TRACE [CreateDestroyLifecycleAction] No destroy method for AbstractKernelControllerContext@3727c5{ metadata=AbstractBeanMetaData@2f1e75{name=VFSDeploymentScanner bean=org.jboss.deployers.plugins.scanner.VFSDeploymentScannerImpl properties=[mainDeployer, URIList] constructor=null}name=VFSDeploymentScanner target=VFSDeploymentScannerImpl@18baf36{} state=Configured depends=AbstractDependencyInfo@19c4091{idependOn=[AbstractDependencyItem@19ed7e{name=VFSDeploymentScanner dependsOn=MainDeployer whenRequired=Configured dependentState=Installed resolved=true}] unresolved=[AbstractDependencyItem@19ed7e{name=VFSDeploymentScanner dependsOn=MainDeployer whenRequired=Configured dependentState=Installed resolved=true}]}}
      40250 TRACE [AbstractKernelController] Uninstalling VFSDeploymentScanner from Configured
      40250 TRACE [ConfigureAction] Ignored for org.jboss.joinpoint.plugins.BasicMethodJoinPoint@ecd92c
      java.lang.NullPointerException
       at org.jboss.deployers.plugins.scanner.VFSDeploymentScannerImpl.setMainDeployer(VFSDeploymentScannerImpl.java:109)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
      


      I guess there needs to be a convention for the injection state of properties vs the bean kernel state. In this particular case I was just obtaining another property from the injected bean so I could actually delegate that to the kernel, but consider the case of deployers registering with the MainDeployer on injection. If there is no explicit start lifecycle, and injection of the MainDeployer was used as a proxy for this, there would be no way to unregister on uninstall. I guess that just means injection cannot be used as a proxy for lifecycle callbacks.


        • 1. Re: Nulling properties on uninstall
          Scott Stark Master

          I am seeing a related problem that seems like a bug on shutdown of the kernel where a long property is being nulled out:

          6125 TRACE [AbstractKernelController] Uninstalling VFSDeploymentScanner from Configured
          166547 TRACE [ConfigureAction] Ignored for org.jboss.joinpoint.plugins.BasicMethodJoinPoint@1d31859
          java.lang.IllegalArgumentException: Wrong arguments. setScanPeriod for target org.jboss.deployers.plugins.scanner.VFSDeploymentScannerImpl@10e7c9e expected=[long] actual=[null]
           at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:224)
           at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
           at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
           at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:65)
           at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:97)
           at org.jboss.kernel.plugins.dependency.ConfigureAction.uninstallAction(ConfigureAction.java:68)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.uninstall(KernelControllerContextAction.java:128)
           at org.jboss.dependency.plugins.AbstractControllerContextActions.uninstall(AbstractControllerContextActions.java:58)
           at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:236)
           at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:605)
           at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:575)
           at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:510)
           at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:194)
           at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.undeployBean(AbstractKernelDeployer.java:367)
           at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.undeployBeans(AbstractKernelDeployer.java:346)
           at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.undeploy(AbstractKernelDeployer.java:149)
           at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.undeploy(BasicKernelDeployer.java:76)
           at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.undeploy(BasicXMLDeployer.java:84)
           at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.shutdown(BasicKernelDeployer.java:90)
           at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.shutdownKernel(ServerImpl.java:719)
           at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.shutdown(ServerImpl.java:691)
           at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.run(ServerImpl.java:674)
          



          • 2. Re: Nulling properties on uninstall
            Adrian Brock Master

            Like I said on another thread, the idea of nulling the property
            is to "help the garbage collector".

            It will catch and ignore any error.

            Without it, there is no way under IOC to "unhook" injections
            which if/when a memory leak occurs will lead to even more memory
            being leaked.

            Whether this is good default behaviour is a different question. :-)