Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Subscription movement to new plugin version fails. #824

Closed
IRCody opened this issue Mar 31, 2016 · 0 comments
Closed

Subscription movement to new plugin version fails. #824

IRCody opened this issue Mar 31, 2016 · 0 comments

Comments

@IRCody
Copy link
Contributor

IRCody commented Mar 31, 2016

Steps to reproduce:

  • Start snap snapd -t 0 -l 1
  • Load collector mock 1 -- snapctl plugin load path/to/collector/mock/1
  • start this task which collects on a metric from mock collector:
{
    "version": 1,
    "schedule": {
        "type": "simple",
        "interval": "1s"
    },
    "workflow": {
        "collect": {
            "metrics": {
                "/intel/mock/foo": {}
            },
            "config": {
                "/intel/mock": {
                    "user": "root",
                    "password": "secret"
                }
            }
        }
    }
}

You can do a task watch/list to verify the task is working.

  • load collector mock 2 which exposes a newer version of the /intel/mock/foo metric.
  • Panic

It seems to be panicking here because pool is nil. RoutingAndCaching is embedded inside Pool and is what actually implements CheckCache. I think the issue is that when the newPool is created for the new plugin it's RoutingAndCaching strategy is not set. There is also a related issue when going from a newer version of a plugin to an older version that causes the task to fail.

INFO[0022] API request                                   _module=_mgmt-rest index=25 method=POST url=/v1/plugins
INFO[0023] Starting workflow for task (af3bf922-82e1-4b3a-8c81-a36e9d90c082\Task-af3bf922-82e1-4b3a-8c81-a36e9d90c082)  _block=workflow-start _module=scheduler-workflow task-id=af3bf922-82e1-4b3a-8c81-a36e9d90c082 task-name=Task-af3bf922-82e1-4b3a-8c81-a36e9d90c082
DEBU[0023] starting collector job                        _module=scheduler-job block=run job-type=collector metric-count=1
DEBU[0023] cache miss [/intel/mock/foo:0]                _module=routing-cache hits=5 misses=6 namespace=/intel/mock/foo:0
DEBU[0023] plugin selected                               _module=control-routing block=select hitcount=5 index=collector:mock:v1:id1 pool size=1 strategy=least-recently-used
DEBU[0023] collector run completed                       _module=scheduler-job block=run job-type=collector metric-count=1
DEBU[0023] task spin loop                                _module=scheduler-task
DEBU[0023] event received                                _block=handle-events _module=scheduler-events event-namespace=Scheduler.MetricsCollected metric-count=1 task-id=af3bf922-82e1-4b3a-8c81-a36e9d90c082
DEBU[0023] wrote 8210560 to /var/folders/f1/_drtvyf57sq8b3gqkb9wl6l80000gp/T/210183924/snap-collector-mock2
INFO[0024] Loading plugin: /var/folders/f1/_drtvyf57sq8b3gqkb9wl6l80000gp/T/210183924/snap-collector-mock2  _module=_mgmt-rest
INFO[0024] plugin load called                            _block=load _module=control
INFO[0024] plugin load called                            _block=load-plugin _module=control-plugin-mgr path=snap-collector-mock2
DEBU[0024] timeout chan start                            _block=waitHandling _module=control-plugin-execution
DEBU[0024] response chan start                           _block=waitHandling _module=control-plugin-execution
DEBU[0024] kill chan start                               _block=waitHandling _module=control-plugin-execution
INFO[0024] API request                                   _module=_mgmt-rest index=26 method=GET url=/v1/plugins
INFO[0024] API response                                  _module=_mgmt-rest index=26 method=GET status=OK status-code=200 url=/v1/plugins
INFO[0024] API request                                   _module=_mgmt-rest index=27 method=GET url=/v1/tasks
INFO[0024] API response                                  _module=_mgmt-rest index=27 method=GET status=OK status-code=200 url=/v1/tasks
DEBU[0024] plugin response (ok) received                 _block=waitHandling _module=control-plugin-execution
DEBU[0024] Getting plugin config                         _block_=getPluginConfigDataNode _module=config config-cache-key=0:mock:2 config-cache-value=&{0x820f26f68 map[]}
DEBU[0024] Hard killing plugin                           _module=control-plugin-execution path=/var/folders/f1/_drtvyf57sq8b3gqkb9wl6l80000gp/T/210183924/snap-collector-mock2
INFO[0024] API response                                  _module=_mgmt-rest index=27 method=POST status=Created status-code=201 url=/v1/plugins
INFO[0024] pool with subscriptions to move found         _block=subscribe-pool _module=control-runner event=Control.PluginLoaded plugin-name=mock plugin-type=collector plugin-version=2
INFO[0024] Nothing to do for this event                  _block=handle-events _module=control-runner event=Control.PluginSubscriptionMoved
INFO[0024] Nothing to do for this event                  _block=handle-events _module=control-runner event=Control.PluginSubscribed
DEBU[0024] handling plugin unsubscription event          _block=subscribe-pool _module=control-runner event=Control.PluginUnsubscribed plugin-name=mock plugin-type=collector plugin-version=1
DEBU[0024] killing an available plugin in pool  collector:mock:1  _block=handle-unsubscription _module=control-runner pool-count=1 pool-subscription-count=0
DEBU[0024] plugin selected                               _module=control-routing block=select hitcount=6 index=collector:mock:v1:id1 pool size=1 strategy=least-recently-used
INFO[0024] hard killing available plugin                 _module=control-aplugin aplugin=collector:mock:v1:id1 block=kill
DEBU[0024] Hard killing plugin                           _module=control-plugin-execution path=/var/folders/f1/_drtvyf57sq8b3gqkb9wl6l80000gp/T/824188841/snap-collector-mock1
INFO[0024] Starting workflow for task (af3bf922-82e1-4b3a-8c81-a36e9d90c082\Task-af3bf922-82e1-4b3a-8c81-a36e9d90c082)  _block=workflow-start _module=scheduler-workflow task-id=af3bf922-82e1-4b3a-8c81-a36e9d90c082 task-name=Task-af3bf922-82e1-4b3a-8c81-a36e9d90c082
DEBU[0024] starting collector job                        _module=scheduler-job block=run job-type=collector metric-count=1
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x48 pc=0x210d87]

goroutine 223 [running]:
panic(0x7272e0, 0x820cce100)
        /usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/intelsdi-x/snap/control/strategy.(*pool).CheckCache(0x820cd7e60, 0x820ee91d0, 0x1, 0x1, 0x820def5f0, 0x24, 0x0, 0x0, 0x0, 0x0, ...)
        <autogenerated>:56 +0xc7
github.com/intelsdi-x/snap/control.(*availablePlugins).collectMetrics(0x820ccf890, 0x820ee91c0, 0x10, 0x820ee91d0, 0x1, 0x1, 0x820def5f0, 0x24, 0x0, 0x0, ...)
        /Users/crosebor/go/src/github.com/intelsdi-x/snap/control/available_plugin.go:372 +0x3a3
github.com/intelsdi-x/snap/control.(*pluginControl).CollectMetrics.func1(0x820db8e70, 0x820def5f0, 0x24, 0x820e80060, 0x820e80000, 0x820ee91c0, 0x10, 0x820ee91d0, 0x1, 0x1)
        /Users/crosebor/go/src/github.com/intelsdi-x/snap/control/control.go:867 +0xb9
created by github.com/intelsdi-x/snap/control.(*pluginControl).CollectMetrics
        /Users/crosebor/go/src/github.com/intelsdi-x/snap/control/control.go:873 +0x626
IRCody added a commit to IRCody/snap that referenced this issue Mar 31, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Mar 31, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Mar 31, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Mar 31, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 4, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 4, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 4, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 5, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 5, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 5, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
@IRCody IRCody changed the title metric rollover to new plugin version problem Subscription movement to new plugin version fails. Apr 6, 2016
jcooklin pushed a commit to jcooklin/snap that referenced this issue Apr 6, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 6, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 6, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit to IRCody/snap that referenced this issue Apr 6, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that
was causing a panic when metric subscriptions were in the process of
being moved.

Modified the handling of load/unload plugin events to properly handle
moving subscriptions between differing versions of a plugin that
provides the same metrics and added tests for this behavior in
control/control_test.go.
IRCody added a commit that referenced this issue Apr 7, 2016
Added a check in availablePlugins.collectMetrics for a nil strategy that

was causing a panic when metric subscriptions were in the process of

being moved.



Modified the handling of load/unload plugin events to properly handle

moving subscriptions between differing versions of a plugin that

provides the same metrics and added tests for this behavior in

control/control_test.go.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants