[
https://issues.apache.org/jira/browse/BROOKLYN-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15821864#comment-15821864
]
Aled Sage commented on BROOKLYN-425:
The underlying problem is that, on rebind, the {{SoftwareProcessImpl.rebind()}}
has scheduled the call to {{connectSensors()}}, so that it happens at a random
point in the next 10 seconds. It does this to avoid the thundering-herd problem.
However, it does it by creating a new {{java.util.Timer()}}. However, when this
executes it does not have the context of which entity is executing, so fails to
execute the ssh command.
A solution is to execute it as a task in the {{ExecutionManager}}. We can do
the same as the existing TimerTask by using the
{{org.apache.brooklyn.util.core.task.ScheduledTask}} (which really needs some
work to make it a better api, but will work).
> Rebinding to MachineEntity: fails to reconnect sensor feeds
> ---
>
> Key: BROOKLYN-425
> URL: https://issues.apache.org/jira/browse/BROOKLYN-425
> Project: Brooklyn
> Issue Type: Bug
>Affects Versions: 0.10.0
>Reporter: Aled Sage
>Priority: Minor
>
> I deployed a MachineEntity to a jclouds location (in this case openstack),
> and then restarted AMP.
> Looking in the log, I saw this exception:
> {noformat}
> 2017-01-12 14:48:55,984 WARN 132 o.a.b.e.s.b.SoftwareProcessImpl [Timer-1]
> Problem connecting sensors on rebind of MachineEntityImpl{id=clu50hvjpd}
> java.lang.IllegalStateException: Cannot execute Task[ssh: Getting machine
> details for:
> SshMachineLocation[10.104.2.116:amp@10.104.2.116/10.104.2.116:22(id=bwjjhxas6l)]]@AaiTH1TI
> without an execution context; ensure caller is in an ExecutionContext
> at
> org.apache.brooklyn.util.core.task.DynamicTasks$TaskQueueingResult.orSubmitInternal(DynamicTasks.java:120)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.util.core.task.DynamicTasks$TaskQueueingResult.orSubmitAsync(DynamicTasks.java:131)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.core.location.BasicMachineDetails.forSshMachineLocationLive(BasicMachineDetails.java:97)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.location.ssh.SshMachineLocation.inferMachineDetails(SshMachineLocation.java:1062)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.location.jclouds.JcloudsSshMachineLocation.inferMachineDetails(JcloudsSshMachineLocation.java:620)[127:org.apache.brooklyn.locations-jclouds:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.location.ssh.SshMachineLocation.getMachineDetails(SshMachineLocation.java:1046)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.location.ssh.SshMachineLocation.getOsDetails(SshMachineLocation.java:1027)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.entity.machine.MachineEntityImpl.connectSensors(MachineEntityImpl.java:58)[132:org.apache.brooklyn.software-base:0.11.0.SNAPSHOT]
> at
> org.apache.brooklyn.entity.software.base.SoftwareProcessImpl$2.run(SoftwareProcessImpl.java:401)[132:org.apache.brooklyn.software-base:0.11.0.SNAPSHOT]
> at java.util.TimerThread.mainLoop(Timer.java:555)[:1.8.0_111]
> at java.util.TimerThread.run(Timer.java:505)[:1.8.0_111]
> {noformat}
> The consequences of this (for {{MachineEntity}}) is that it didn't call
> {{AddMachineMetrics.createMachineMetricsFeed}}, which it should have done if
> the VM was linux. Sensors like load-average, cpu-usage, etc will therefore
> not be updated.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)