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/04/06 12:16:41 UTC

[jira] [Commented] (BROOKLYN-468) restart effector does not restart the entity's feeds

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

Aled Sage commented on BROOKLYN-468:
------------------------------------

The consequence for me is that sometimes the entity's {{restart}} effector fails, because it never gets to {{service.isUp}}. This is because there is a not-up indicator based on the feed's output.

If the feed manages to poll while the process is stopping/stopped, then it reports the entity as unhealthy, but then never checks again.

Below are some snippets from the yaml blueprint:

{noformat}
        brooklyn.initializers:
        - type: org.apache.brooklyn.core.sensor.http.HttpRequestSensor
          brooklyn.config:
            name: service.isHealthy
            period: 5s
            jsonPath: "$"
            uri:
              $brooklyn:formatString:
              - "%s/v1/server/healthy"
              - $brooklyn:attributeWhenReady("main.uri.public")


        brooklyn.enrichers:
        - type: org.apache.brooklyn.enricher.stock.UpdatingMap
          brooklyn.config:
            enricher.sourceSensor: $brooklyn:sensor("service.isHealthy")
            enricher.targetSensor: $brooklyn:sensor("service.notUp.indicators")
            enricher.updatingMap.computing:
              $brooklyn:object:
                type: "com.google.guava:com.google.common.base.Functions"
                factoryMethod.name: "forMap"
                factoryMethod.args:
                - "false": false
                  "true": null
                - "false"
{noformat}

I believe this can happen because the {{stop}} impl, which calls {{MachineLifecycleEffectorTasks.StopFeedsAtMachineTask}}, uses a parallel task to stop the process and stop the feeds simultaneously, so it's race as to whether the feed spots the process is not "healthy" before the feed stops. Note that doing it sequentially might still have a race: it cancels the tasks, but does not wait for the tasks to fully terminate, so a thread might be running in the background doing its poll and populating the sensor.

However, all of that is an aside: the feed should be restarted when the process is restarted, so that subsequent changes to the entity's state are reported.

> restart effector does not restart the entity's feeds
> ----------------------------------------------------
>
>                 Key: BROOKLYN-468
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-468
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.10.0
>            Reporter: Aled Sage
>
> I have a yaml-based {{VanillaSoftwareProcess}}. I called its {{restart}} effector. This caused its feeds to be stopped, and not restarted (as visible via the Groovy console:
> {noformat}
> mgmt.getEntityManager().getEntity("qafop4hk6f").feeds().getFeeds()
> [HttpFeed{uniqueTag=HttpFeed[http[service.isHealthy]], running=false, entity=VanillaSoftwareProcessImpl{id=qafop4hk6f}, id=gt1wzcfb2r}, HttpFeed{uniqueTag=HttpFeed[http[service.status]], running=false, entity=VanillaSoftwareProcessImpl{id=qafop4hk6f}, id=u2dx5wkii7}]
> {noformat}
> IMO, when the entity restarts the feeds should be automatically restarted.
> The same applies if you call {{stop}} and then later call {{start}}.
> One tricky thing is we don't know which feeds were actually running before {{stop}} was called - should we start all the feeds? Or should we record which feeds we've automatically stopped, so we know which ones to start? (For the latter, that could prove tricky if Brooklyn is restarted - we'd need to persist it, which gets annoying.)



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