intelsdi-x / snap-plugin-collector-snmp

Collects SNMP metrics
http://snap-telemetry.io/
Apache License 2.0
7 stars 10 forks source link

Potential thread safety issue during initialisation of plugin #13

Closed lmroz closed 7 years ago

lmroz commented 7 years ago

I'm just copy&pasting @obourdon 's issue and pointing to the line https://github.com/intelsdi-x/snap-plugin-collector-snmp/blob/master/collector/collector.go#L170 because lack of time to take care of this now, but it should be easy fix.

Snap version (use snapctl -v): ANY Environment:

  • Cloud provider or hardware configuration: ANY
  • OS (e.g. from /etc/os-release): Linux (Debian 8.0 & Ubuntu 1[46].04 amd64)

Potential thread safety issue during initialisation of plugin

Looking at a PR which has been integrated earlier for the SMART plugin, and more specifically at commit bf7c332 and commit dada577 which have been added to comply with @lmroz comment r73497782, the same code should be integrated into processes collector plugin

IzabellaRaulin commented 7 years ago

This plugin uses sticky routing strategy, so concurrency count is set to 1, what means there is no possibilities to use a single plugin instance by two tasks.

There is also an issue to provide Init() once function behavior to plugin lib to make easier manage initialization in plugins which require that - 👉 https://github.com/intelsdi-x/snap-plugin-lib-go/issues/79

Based on above, I will close this issue. Of course, please do not hesitate to re-open if you notice that this issue is still valid in some circumstances. Thank You.