You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by alasdairhodge <gi...@git.apache.org> on 2017/02/01 15:13:39 UTC

[GitHub] brooklyn-server pull request #548: Clean up now-orphaned locations after unm...

GitHub user alasdairhodge opened a pull request:

    https://github.com/apache/brooklyn-server/pull/548

    Clean up now-orphaned locations after unmanaging an entity

    Invoking "unmanage" operation on an entity leads to orphaned locations. More seriously, orphaned `JcloudsSshMachineLocation` instances still contain defunct references to the unmanaged entity, which subsequently causes dangling-reference errors on rebind.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alasdairhodge/brooklyn-server unmanage-orphaned-locations

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/548.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #548
    
----
commit b789933d221c47487b144c39a32dc735e944e4c0
Author: Alasdair Hodge <gi...@alasdairhodge.co.uk>
Date:   2017-02-01T13:53:12Z

    Clean up now-orphaned locations after unmanaging an entity.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #548: Clean up now-orphaned locations after unm...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/548#discussion_r99079636
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java ---
    @@ -475,6 +483,19 @@ private void unmanage(final Entity e, ManagementTransitionMode mode, boolean has
             entityModesById.remove(e.getId());
         }
         
    +    private void pruneOrphanedLocations(Entity unmanagedEntity) {
    +        Set<Location> orphanLocations = MutableSet.copyOf(unmanagedEntity.getLocations());
    +        for (Entity e : getEntities()) {
    +            if (e == unmanagedEntity)
    +                continue;
    +            orphanLocations.removeAll(e.getLocations());
    +        }
    +        LocationManager lm = managementContext.getLocationManager();
    +        for (Location l : orphanLocations) {
    +            lm.unmanage(l);
    +        }
    +    }
    --- End diff --
    
    Perhaps this method should be moved onto `ManagementContextInternal` and broadened to GC orphans of all types? As it stands, we're coupling `LocalEntityManger` to `(Local)LocationManager`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    Investigating test failure now...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    Closing this PR, as my "fix" has some undesired consequences: unmanaging a jclouds machine lcoation causes any underlying VM to be released!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #548: Clean up now-orphaned locations after unm...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge closed the pull request at:

    https://github.com/apache/brooklyn-server/pull/548


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    Build failure due to missing 0.9.x artifacts in Nexus...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    Linked issue: https://issues.apache.org/jira/browse/BROOKLYN-432


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    So the unit tests assert that `unmanage` leaves orphaned locations. Obviously, I think this is broken behaviour, but let's see what the consensus is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server issue #548: Clean up now-orphaned locations after unmanaging...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on the issue:

    https://github.com/apache/brooklyn-server/pull/548
  
    Feedback welcome, @ahgittin and @aledsage 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] brooklyn-server pull request #548: Clean up now-orphaned locations after unm...

Posted by alasdairhodge <gi...@git.apache.org>.
Github user alasdairhodge commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/548#discussion_r99081663
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java ---
    @@ -419,6 +422,7 @@ private void unmanage(final Entity e, ManagementTransitionMode mode, boolean has
                     // migrating away or in-place active partial rebind:
                     ((EntityInternal)e).getManagementSupport().onManagementStopping(info);
                     stopTasks(e);
    +                pruneOrphanedLocations(e);
    --- End diff --
    
    Not sure whether this is the right thing to do in this situation, as we don't actually remove the entity from the internal collections.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---