11 Replies Latest reply on Feb 2, 2009 11:05 AM by brian.stansberry

    Stopping deletes files in deploy-hasingleton

    j-n00b

      Hi!

      Sorry for double posting, I was asked to create a new thread here. The original post is available at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149554.

      My problem is the following: when shutting down a clustered server, all files in "server/all/deploy-hasingleton" are deleted. Does anyone know, why this happens?

      Cheers,
      Andre

        • 1. Re: Stopping deletes files in deploy-hasingleton
          brian.stansberry

          Merging in useful input from the other thread:

          "jaikiran" wrote:
          Found it. It looks like it's the SerializableDeploymentRepository which does this:


          protected VFSDeployment removeApplication(String vfsPath) throws Exception
           {
           VFSDeployment vfsDeployment = getApplication(vfsPath);
           VirtualFile root = vfsDeployment.getRoot();
           if(root.delete() == false)
           throw new IOException("Failed to delete: " + root);
          
           return this.applicationCtxs.remove(vfsPath);
           }


          Not sure why the application needs to be physically deleted.


          I'll have a look at how the HASingletonDeploymentScanner is interacting with the ProfileService to see if I can find a way to avoid this.

          • 2. Re: Stopping deletes files in deploy-hasingleton
            emuckenhuber

             

            bstansberry@jboss.com wrote:

            I'll have a look at how the HASingletonDeploymentScanner is interacting with the ProfileService to see if I can find a way to avoid this.


            Yes that's unfortunately the behavior in AS 5.0.x - and the DeploymentManager needs to be some cleanup.
            DeploymentManager.undeploy() removes the application. This does not really make sense to me.

            In this case you might just want to call DeploymentManager.stop().
            This won't remove the app, from the deployment repository, but at least the deployment
            would get ignored from the hot-deployment scanning.

            • 3. Re: Stopping deletes files in deploy-hasingleton
              j-n00b

              Thanks for the fast reply!

              but at least the deployment
              would get ignored from the hot-deployment scanning.

              Mmmh, I am not sure, but is "deploy-hasingleton" really able to handle hot deployments?

              • 4. Re: Stopping deletes files in deploy-hasingleton
                brian.stansberry

                 

                "emuckenhuber" wrote:

                Yes that's unfortunately the behavior in AS 5.0.x - and the DeploymentManager needs to be some cleanup.
                DeploymentManager.undeploy() removes the application. This does not really make sense to me.


                IIRC my original thinking on this was that the deploy-hasingleton/ dir wasn't even relevant to the repository; i.e. the HASingletonDeploymentScanner was using distribute() to upload content from some-location-unknown-to-the-repository, which would then make a copy of it in its own work dir. Which for DeploymentPhase.APPLICATION would be the deploy/ dir.

                The undeploy() call would reverse that.

                Obviously that's not what's happening now. Now it seems like deploy-hasingleton is becoming one of the URIs the repository tracks. I'm looking why.

                Having the repository aware of deploy-hasingleton does have the advantage of making the content hot-deployable, which was never the case in AS 4.

                j-n00b, I don't see why the deploy-hasingleton content couldn't be hot-deployable. Whether the implementation allows it is a different question, but logically I don't see why it couldn't be.


                In this case you might just want to call DeploymentManager.stop().
                This won't remove the app, from the deployment repository, but at least the deployment
                would get ignored from the hot-deployment scanning.


                Yeah, that might work.

                • 5. Re: Stopping deletes files in deploy-hasingleton
                  emuckenhuber

                   

                  "j-n00b" wrote:
                  Mmmh, I am not sure, but is "deploy-hasingleton" really able to handle hot deployments?


                  Sorry, this was more an information for Brian :)
                  The only thing i wanted to say is that, the HDScanner should not pick up the deployment again
                  although it can't be really removed from the repo.

                  But i'm afraid that you can't really do something about that yet - i guess we need to fix it...

                  • 6. Re: Stopping deletes files in deploy-hasingleton
                    brian.stansberry

                    OK, this looks simple enough. The HASingletonDeploymentScanner has two sets of logic, one that works with the old basic ProfileService, the other that works with a repository ProfileService. The latter is used if the scanner has a ref to a DeploymentManager. The problem is the DeploymentManager isn't dependency injected, it's pulled from the ProfileService when the PS is injected. Problem is when the PS is injected, the DeploymentManager hasn't been installed yet, so no DeploymentManager...

                    Bottom line, it's a dependency issue. For a workaround I'll play around to get the magic sauce to add the needed dependency. Proper fix is to dependency inject the DeploymentManager.

                    Scott/Emmanuel, is the old basic ProfileService still valid in any way? I'd like to strip the code that works with it out, as the issue j-n00b found shows that that code's broken.

                    • 7. Re: Stopping deletes files in deploy-hasingleton
                      emuckenhuber

                       

                      "bstansberry@jboss.com" wrote:

                      Scott/Emmanuel, is the old basic ProfileService still valid in any way? I'd like to strip the code that works with it out, as the issue j-n00b found shows that that code's broken.


                      Well it will remain valid for 5.0.x - but i think we will port some updates from trunk into the 5.1 branch,
                      once the work is more or less done in trunk.
                      Most probably i will remove this deploymentScanner from trunk at one point :)

                      • 8. Re: Stopping deletes files in deploy-hasingleton
                        brian.stansberry

                         

                        "emuckenhuber" wrote:
                        Most probably i will remove this deploymentScanner from trunk at one point :)


                        Yes, as soon as we get the "independent profiles" issue sorted I'll remove HASingletonDeploymentScanner from trunk. I believe it stopped working correctly a couple weeks back when you made your first PS changes . At least the test starting failing on my machine. I didn't bother debugging the failure cause, just focused on the new activation-based replacement.

                        • 9. Re: Stopping deletes files in deploy-hasingleton
                          brian.stansberry

                          OK, three JIRAs come out of this thread:

                          https://jira.jboss.org/jira/browse/JBAS-6440
                          https://jira.jboss.org/jira/browse/JBAS-6441
                          https://jira.jboss.org/jira/browse/JBAS-6439

                          The first JIRA will fix the problem j-n00b is seeing by causing the correct code to execute.

                          j-n00b, there is a workaround that will solve your problem. As described on the JIRA:

                          Edit the server/all/deploy/profileservice-jboss-beans.xml file's "DeploymentManager" bean to add the following element:
                          
                          <supply>DeploymentManager</supply>
                          
                          Edit the server/all/deploy/cluster/deploy-hasingleton-jboss-beans.xml file's "HASingletonDeploymentScanner" bean to add the following element:
                          
                          <demand state="Instantiated">DeploymentManager</demand>



                          Second JIRA is for another bug I found, which will show itself if the above workaround is implemented but deploy-hasingleton/ doesn't have content. Simple solution is to not bother putting in the above workaround if you don't have content. :-)

                          Third JIRA is for the problem with the non-DeploymentManager based impl, which is what is leading to the removed files. I won't be "fixing" that, I'll just be removing support for the basic ProfileService from HASingletonDeploymentScanner.


                          Just to clarify an earlier point, this HASingletonDeploymentScanner approach to managing deploy-hasingleton *does not* support hot-deployment of deploy-hasingleton content. The content in the dir when the node becomes the master is what gets deployed; thereafter the dir is not monitored for changes.

                          The new approach to this we're working on in trunk should support hot-deployment.

                          Many thanks to j-n00b for the report and for following jaikiran's advice and reposting here where I'd see it.

                          • 10. Re: Stopping deletes files in deploy-hasingleton
                            j-n00b

                            You're welcome! Actually I have to thank you for taking care ;-)

                            "bstansberry@jboss.com" wrote:

                            j-n00b, I don't see why the deploy-hasingleton content couldn't be hot-deployable. Whether the implementation allows it is a different question, but logically I don't see why it couldn't be.

                            My statement is based on the information of the Admin Guide (chapter 20.11.1):
                            There is no hot-deployment feature for services in deploy-hasingleton. Redeploying a service that has been deployed to deploy-hasingleton requires a server restart.


                            Cheers,
                            Andre

                            • 11. Re: Stopping deletes files in deploy-hasingleton
                              brian.stansberry

                               

                              "j-n00b" wrote:

                              My statement is based on the information of the Admin Guide (chapter 20.11.1):
                              There is no hot-deployment feature for services in deploy-hasingleton. Redeploying a service that has been deployed to deploy-hasingleton requires a server restart.


                              Cool; something where the docs are still correct. ;-)