brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (BROOKLYN-356) The sensor Transformer enricher fails to resolve its targetValue indeterministically.
Date Wed, 26 Oct 2016 19:44:58 GMT


ASF GitHub Bot commented on BROOKLYN-356:

Github user geomacy commented on a diff in the pull request:
    --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/dsl/
    @@ -198,9 +275,44 @@ public ParentTestWorker(TestApplication parent, BrooklynDslDeferredSupplier<?>
    -        protected void postResolve(Maybe<?> actualValue) {
    +        protected void postResolve(TestEntity entity, Maybe<?> actualValue) {
                 assertEquals(actualValue.get(), parent);
    +    static Maybe<?> execDslImmediately(final BrooklynDslDeferredSupplier<?>
dsl, final Class<?> type, final Entity context, boolean execInTask) throws Exception
    +        // Exec'ing immediately will call DSL in current thread. It needs to find the
context entity,
    +        // and does this using BrooklynTaskTags.getTargetOrContextEntity(Tasks.current()).
    +        // If we are not in a task executed by the context entity, then this lookup will
    +        Callable<Maybe<?>> job = new Callable<Maybe<?>>() {
    +            public Maybe<?> call() throws Exception {
    +                return Tasks.resolving(dsl).as(type)
    +                        .context(context)
    +                        .description("Computing "+dsl)
    +                        .immediately(true)
    +                        .getMaybe();
    +            }
    +        };
    +        if (execInTask) {
    +            Task<Maybe<?>> task = ((EntityInternal)context).getExecutionContext().submit(job);
    +            task.get(Asserts.DEFAULT_LONG_TIMEOUT);
    +            assertTrue(task.isDone());
    +            return task.get();
    +        } else {
    +            return;
    +        }
    +    }
    +    static Maybe<?> execDslRealRealyQuick(BrooklynDslDeferredSupplier<?>
dsl, Class<?> type, Entity context) {
    --- End diff --
    typo(?) `execDslRealRealQuick` or even better `execDslReallyReallyQuick`, old-fashioned
believer in adverbs that I am.

> The sensor Transformer enricher fails to resolve its targetValue indeterministically.
> -------------------------------------------------------------------------------------
>                 Key: BROOKLYN-356
>                 URL:
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Svetoslav Neykov
> The sensor {{Transformer}} enricher fails to resolve its {{targetValue}} indeterministically,
especially so on loaded systems. This is especially problematic if sourceSensor/triggerSensors
change infrequently or do not change ever (when using default values).
> Bueprints using the {{Transformer}} behave perfectly fine during development and on test
setups, but will fail on production machines (i.e. under load).
> The code [doing the value resolving|]
tries to do so in a non-blocking fashion by spinning a thread to try to resolve and cancelling
it after a short while without guarantees it ever got scheduled to run. It's more likely to
fail when nesting DSLs, for example nesting several levels of {{$brooklyn:formatString}} and
ending with a {{$brooklyn:attributeWhenRready}}. It's a common pattern in moderately complex
blueprints. It needs to schedule a thread for each nesting level thus maximizing the chance
that the value will not be resolved in the allotted time even if resolvabe. This is especially
bad for sensors which don't get updated, for example {{PortAttributeSensorAndConfigKey} set
only when initializing the entity or any config values which are always resolvable.

This message was sent by Atlassian JIRA

View raw message