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

Snapteld crashes when a task for a stream collector is created #1650

Closed
ericho opened this issue May 28, 2017 · 2 comments
Closed

Snapteld crashes when a task for a stream collector is created #1650

ericho opened this issue May 28, 2017 · 2 comments

Comments

@ericho
Copy link

ericho commented May 28, 2017

Trying to create the following task snapteld crashes. I'm using version 1.2.0 on Ubuntu 16.04

{
    "version" : 1,
    "schedule" : {
        "type" : "simple",
        "interval": "5s"
    },
    "workflow": {
        "collect": {
            "metrics": {
                "/random/*": {}
            },
            "config": {},
            "process": null,
            "publish": null
        }
    }
}

These are the steps to reproduce:

$ snapteld -l 1 -t 0

$ snaptel plugin load streaming-example-plugin
$ snaptel task create --task-manifest task.json

After the snaptel task create command the following crash occur in snapteld

DEBU[2017-05-28T10:50:34-05:00] cache miss [/random/integer:1]                _module=routing-cache hits=0 misses=1 namespace=/random/integer:1
DEBU[2017-05-28T10:50:34-05:00] cache miss [/random/float:1]                  _module=routing-cache hits=0 misses=1 namespace=/random/float:1
DEBU[2017-05-28T10:50:34-05:00] cache miss [/random/string:1]                 _module=routing-cache hits=0 misses=1 namespace=/random/string:1
DEBU[2017-05-28T10:50:34-05:00] plugin selected                               _module=control-routing block=select hitcount=0 index=collector:test-rand-streamer:v1:id1 pool size=1 strategy=least-recently-used
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x62535a]

goroutine 95 [running]:
panic(0xad9b80, 0xc420014100)
	/home/travis/.gimme/versions/go1.7.3.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/intelsdi-x/snap/control/plugin/client.(*grpcClient).CollectMetrics(0xc42008a120, 0xc4202ed900, 0x3, 0x4, 0xf24501, 0xc42022c000, 0x0, 0x0, 0x4)
	/home/travis/gopath/src/github.com/intelsdi-x/snap/control/plugin/client/grpc.go:271 +0xda
github.com/intelsdi-x/snap/control.(*availablePlugins).collectMetrics(0xc420176b90, 0xc420183d40, 0x24, 0xc420159500, 0x3, 0x4, 0xc420182930, 0x24, 0x0, 0x0, ...)
	/home/travis/gopath/src/github.com/intelsdi-x/snap/control/available_plugin.go:434 +0x386
github.com/intelsdi-x/snap/control.(*pluginControl).CollectMetrics.func1(0xc42001a180, 0xc420182930, 0x24, 0xc42016b8c0, 0xc42016b800, 0xc420183d40, 0x24, 0xc420159500, 0x3, 0x4)
	/home/travis/gopath/src/github.com/intelsdi-x/snap/control/control.go:979 +0xb2
created by github.com/intelsdi-x/snap/control.(*pluginControl).CollectMetrics
	/home/travis/gopath/src/github.com/intelsdi-x/snap/control/control.go:985 +0xad7

@katarzyna-z
Copy link
Contributor

katarzyna-z commented May 29, 2017

Thanks for reporting this issue 🐢 Snap shouldn't crash.
Work on streaming feature is still in progress, please see following pull requests: snap#1632 and snap-plugin-lib-go#85.
However you can test how streaming works for now, you need to change type in schedule to "streaming" and use pure REST API to create a task (for now snaptel does not support streaming), see examplary task manifest:

{
  "version": 1,
  "schedule": {
    "type": "streaming"
  },
  "start": true,
  "max-failures": 10,
  "max-collect-duration": "10s",
  "max-metrics-buffer": 4,
  "workflow": {
    "collect": {
      "metrics": {
        "/random/*": {}
      },
      "config": {},
      "process": null,
      "publish": null
    }
  }
}

and exemplary curl command to create a task:

curl -vX POST localhost:8181/v1/tasks -d @task.json --header "Content-Type: application/json"

Using the code from current versions of pull requests snap#1632 and snap-plugin-lib-go#85 I'm able to reproduce this issue using following task manifest:

{
    "version" : 1,
    "schedule" : {
        "type" : "simple",
        "interval": "5s"
    },
    "start": true,
    "max-failures": 10,
    "workflow": {
        "collect": {
            "metrics": {
                "/random/*": {}
            },
            "config": {},
            "process": null,
            "publish": null
        }
    }
}

@ericho
Copy link
Author

ericho commented May 29, 2017

Hi @katarzyna-z, thank you very much for the workaround. Now I'm able to test my plugin.

I'll be pending of the related PR 😄

jcooklin added a commit to jcooklin/snap that referenced this issue Jun 5, 2017
If the scheduler type is streaming we ensure that only a single streaming collector is configured.  If the scheduler type is not streaming we ensure that a streaming plugin is not referenced.
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

3 participants