Uploaded image for project: 'Brooklyn'
  1. Brooklyn
  2. BROOKLYN-285

Dangling reference in Propagator.producer: can cause subscription to self, and infinite subscription loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.9.0
    • 0.10.0
    • None

    Description

      When the "producer" entity of a Propagator enricher is unmanaged, it can cause rebind to resolve the dangling reference value as null. In 0.9.0, that is treated as the producer being "self". This can cause an infinite loop, where the Propagator subscribes to its own sensor, and every time its sensor changes it resets the sensor value.

      To reproduce, deploy this app:

      location: localhost
      services:
      - type: org.apache.brooklyn.entity.stock.BasicApplication
        brooklyn.children:
        - type: org.apache.brooklyn.entity.machine.MachineEntity
      

      And programmatically add a Propagator enricher to the top-level app, such as:

      appId = "u4VDoIOa";
      childId = "LPYT4g27";
      sensor = org.apache.brooklyn.core.sensor.Sensors.newSensor(String.class, "host.name");
      app = mgmt.getEntityManager().getEntity(appId);
      child = mgmt.getEntityManager().getEntity(childId);
      app.enrichers().add(org.apache.brooklyn.api.sensor.EnricherSpec.create(org.apache.brooklyn.enricher.stock.Propagator.class)
          .configure("enricher.producer", child)
          .configure("enricher.propagating.inclusions", com.google.common.collect.ImmutableList.of(sensor)));
      

      Then unmanange the child entity (e.g. via the advanced tab in the web-console), and restart Brooklyn.

      The CPU goes through the roof, and the debug log shows log messages like:

      2016-05-31 09:02:22,599 DEBUG o.a.b.c.m.i.LocalSubscriptionManager [brooklyn-execmanager-gfOvVoKq-3]: 388000 events for subscriber Subscription[qF9YFEBA;BasicApplicationImpl{id=u4VDoIOa}@u4VDoIOa:host.name]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            aled.sage Aled Sage
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: