You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2017/03/23 10:06:41 UTC

[jira] [Created] (BROOKLYN-457) App creation hangs when transformer's "producer" config not yet available

Aled Sage created BROOKLYN-457:
----------------------------------

             Summary: App creation hangs when transformer's "producer" config not yet available
                 Key: BROOKLYN-457
                 URL: https://issues.apache.org/jira/browse/BROOKLYN-457
             Project: Brooklyn
          Issue Type: Bug
            Reporter: Aled Sage


[~mike.zaccardo] shared a blueprint that hangs when starting (in version 0.11.0-SNAPSHOT). I've turned that into a unit test, below (which hangs when trying to instantiate the app):

{noformat}
    @Test
    public void testTransformerProducerUsesDslAttributeWhenReady() throws Exception {
        String yaml = Joiner.on("\n").join(
                "brooklyn.catalog:",
                "    version: 0.2-SNAPSHOT",
                "    items:",
                "    - id: test-cluster",
                "      name: test-cluster",
                "      item:",
                "        type: org.apache.brooklyn.entity.group.DynamicCluster",
                "        memberSpec:",
                "          $brooklyn:entitySpec:",
                "            type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess",
                "            name: \"Node\"",
                "        brooklyn.enrichers:",
                "          - type: org.apache.brooklyn.enricher.stock.Transformer",
                "            brooklyn.config:",
                "              enricher.producer: $brooklyn:entity($brooklyn:attributeWhenReady(\"cluster.first.entity\"))",
                "              enricher.sourceSensor: $brooklyn:entity($brooklyn:attributeWhenReady(\"cluster.first.entity\")).sensor(\"host.name\")",
                "              enricher.targetSensor: $brooklyn:sensor(\"cluster_first_host\")",
                "              enricher.targetValue:",
                "                $brooklyn:formatString:",
                "                - \"%s\"",
                "                - $brooklyn:entity($brooklyn:attributeWhenReady(\"cluster.first.entity\")).attributeWhenReady(\"host.name\")");
        addCatalogItems(yaml);
        
        String appYaml = Joiner.on("\n").join(
                "location: localhost",
                "services:",
                "- type: test-cluster");
        
        Entity app = createAndStartApplication(appYaml);
        
        EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true);
        EntityAsserts.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
    }
{noformat}

Looking at the stacktrace (via {{jstack <pid>}}):

{noformat}
"brooklyn-execmanager-vQN0JoRL-1" daemon prio=5 tid=0x00007f8ffd47f800 nid=0x5907 waiting on condition [0x000070000390e000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000007f9bf87e8> (a java.util.concurrent.FutureTask)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
        at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:425)
        at java.util.concurrent.FutureTask.get(FutureTask.java:187)
        at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)
        at org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:361)
        at org.apache.brooklyn.util.time.Durations.get(Durations.java:43)
        at org.apache.brooklyn.util.time.Durations.get(Durations.java:68)
        at org.apache.brooklyn.util.core.task.ValueResolver.getMaybeInternal(ValueResolver.java:488)
        at org.apache.brooklyn.util.core.task.ValueResolver.getMaybe(ValueResolver.java:323)
        at org.apache.brooklyn.util.core.task.ValueResolver.get(ValueResolver.java:316)
        at org.apache.brooklyn.util.core.task.Tasks.resolveValue(Tasks.java:147)
        at org.apache.brooklyn.core.config.BasicConfigKey.resolveValue(BasicConfigKey.java:405)
        at org.apache.brooklyn.core.config.BasicConfigKey.extractValue(BasicConfigKey.java:390)
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.resolveRawValueFromContainer(AbstractConfigMapImpl.java:319)
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl$3.apply(AbstractConfigMapImpl.java:379)
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl$3.apply(AbstractConfigMapImpl.java:1)
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.getConfigImpl(AbstractConfigMapImpl.java:392)
        at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.getConfig(AbstractConfigMapImpl.java:109)
        at org.apache.brooklyn.core.objs.AbstractConfigurationSupportInternal.get(AbstractConfigurationSupportInternal.java:165)
        at org.apache.brooklyn.core.objs.AbstractEntityAdjunct.getConfig(AbstractEntityAdjunct.java:330)
        at org.apache.brooklyn.enricher.stock.AbstractTransformer.setEntity(AbstractTransformer.java:83)
        at org.apache.brooklyn.core.entity.AbstractEntity$BasicEnricherSupport.add(AbstractEntity.java:1695)
        at org.apache.brooklyn.core.objs.proxy.InternalEntityFactory$1.run(InternalEntityFactory.java:361)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:529)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
{noformat}

This is caused by {{AbstractTransformer}} initialisation (in {{setEntity}}) trying to resolve the `producer` config value. This is happening while the entity is still being created (i.e. {{InternalEntityFactory}} is lower down the stacktrace) so the entity never finishes being created, and the sensor is never set.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)