brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aled Sage (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BROOKLYN-285) Dangling reference in Propagator.producer: can cause subscription to self, and infinite subscription loop
Date Tue, 31 May 2016 08:11:12 GMT

    [ https://issues.apache.org/jira/browse/BROOKLYN-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307409#comment-15307409
] 

Aled Sage commented on BROOKLYN-285:
------------------------------------

Note that this problem does not occur if the enricher is defined in pure YAML:

{noformat}
location: localhost
services:
- type: org.apache.brooklyn.entity.stock.BasicApplication
  brooklyn.enrichers:
  - type: org.apache.brooklyn.enricher.stock.Propagator
    brooklyn.config:
      enricher.producer: $brooklyn:component("childid")
      enricher.propagating.inclusions:
      - $brooklyn:sensor("host.name")
  brooklyn.children:
  - type: org.apache.brooklyn.entity.machine.MachineEntity
    id: childid
{noformat}

In this case, the producer's value is a {{DslComponent}} deferred supplier. When rebinding,
it gives the warning below which causes the enricher to not be registered (thus avoiding the
infinite loop):

{noformat}
2016-05-31 08:51:13,622 WARN  o.a.b.c.m.r.RebindExceptionHandlerImpl [brooklyn-execmanager-eKemWLAc-0]:
problem adding enricher TCHZy1xV (Propagator{name=org.apache.brooklyn.enricher.stock.Propagator,
running=true, entity=BasicApplicationImpl{id=PVwPwv0Z}, id=TCHZy1xV})
 to entity PVwPwv0Z (BasicApplicationImpl{id=PVwPwv0Z}); continuing
java.lang.IllegalArgumentException: Error resolving config enricher.producer, $brooklyn:entity("childid"),
in org.apache.brooklyn.util.core.task.BasicExecutionContext@17deda19([Wrapped[contextEntity:BasicApplicationImpl{id=PVwPwv0Z}],
LocalManagementContext[tD3GpJjV-eKe
mWLAc]]): org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: NoSuchElementException:
No entity matching id childid
        at org.apache.brooklyn.util.core.task.ValueResolver.getMaybeInternal(ValueResolver.java:411)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.ValueResolver.getMaybe(ValueResolver.java:257)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.ValueResolver.get(ValueResolver.java:250) ~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.Tasks.resolveValue(Tasks.java:139) ~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.config.BasicConfigKey.resolveValue(BasicConfigKey.java:294)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.config.BasicConfigKey.extractValue(BasicConfigKey.java:279)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.objs.AdjunctConfigMap.getConfig(AdjunctConfigMap.java:85)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.getConfig(AbstractConfigMapImpl.java:50)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.objs.AbstractEntityAdjunct$BasicConfigurationSupport.get(AbstractEntityAdjunct.java:291)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.objs.AbstractEntityAdjunct.getConfig(AbstractEntityAdjunct.java:366)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.enricher.stock.Propagator.setEntity(Propagator.java:90) ~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.entity.AbstractEntity$BasicEnricherSupport.add(AbstractEntity.java:1746)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport.addEnrichers(BasicEntityRebindSupport.java:145)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport.addEnrichers(BasicEntityRebindSupport.java:47)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.associateAdjunctsWithEntities(RebindIteration.java:649)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.doRun(RebindIteration.java:243)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.InitialFullRebindIteration.doRun(InitialFullRebindIteration.java:69)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:265)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebindImpl(RebindManagerImpl.java:552)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:502)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:500)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:519)
[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: 
        at org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:128) ~[org.apache.brooklyn-brooklyn-utils-common-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.time.Durations.get(Durations.java:59) ~[org.apache.brooklyn-brooklyn-utils-common-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.time.Durations.get(Durations.java:64) ~[org.apache.brooklyn-brooklyn-utils-common-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.ValueResolver.getMaybeInternal(ValueResolver.java:348)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        ... 25 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException:
NoSuchElementException: No entity matching id childid
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.get(FutureTask.java:188) [na:1.7.0_71]
        at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)
~[com.google.guava-guava-17.0.jar:na]
        at org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:361) ~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.time.Durations.get(Durations.java:43) ~[org.apache.brooklyn-brooklyn-utils-common-0.9.0.jar:0.9.0]
        ... 27 common frames omitted
Caused by: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: 
        at org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:128) ~[org.apache.brooklyn-brooklyn-utils-common-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier.get(BrooklynDslDeferredSupplier.java:136)
~[org.apache.brooklyn-brooklyn-camp-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.ValueResolver$2.call(ValueResolver.java:334)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:359)
~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        ... 5 common frames omitted
Caused by: java.util.concurrent.ExecutionException: java.util.NoSuchElementException: No entity
matching id childid
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.get(FutureTask.java:188) [na:1.7.0_71]
        at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)
~[com.google.guava-guava-17.0.jar:na]
        at org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:361) ~[org.apache.brooklyn-brooklyn-core-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier.get(BrooklynDslDeferredSupplier.java:129)
~[org.apache.brooklyn-brooklyn-camp-0.9.0.jar:0.9.0]
        ... 7 common frames omitted
Caused by: java.util.NoSuchElementException: No entity matching id childid
        at org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent$EntityInScopeFinder.call(DslComponent.java:138)
~[org.apache.brooklyn-brooklyn-camp-0.9.0.jar:0.9.0]
        at org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent$EntityInScopeFinder.call(DslComponent.java:81)
~[org.apache.brooklyn-brooklyn-camp-0.9.0.jar:0.9.0]
        ... 6 common frames omitted
{noformat}


> Dangling reference in Propagator.producer: can cause subscription to self, and infinite
subscription loop
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: BROOKLYN-285
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-285
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Aled Sage
>
> 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:
> {noformat}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
>   brooklyn.children:
>   - type: org.apache.brooklyn.entity.machine.MachineEntity
> {noformat}
> And programmatically add a Propagator enricher to the top-level app, such as:
> {noformat}
> 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)));
> {noformat}
> 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:
> {noformat}
> 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]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message