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

Loading collector twice causes failure of task creation #1128

Closed
ghost opened this issue Aug 8, 2016 · 3 comments
Closed

Loading collector twice causes failure of task creation #1128

ghost opened this issue Aug 8, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 8, 2016

Description

The issue appears when one accidentally attempts to load already loaded collector plugin. Framework informs that plugin has been already loaded, but after that creating a task fails. snapd needs to be restarted and all the plugins loaded properly from the beginning in order to run a task. This is quite confusing as it seems that something is wrong with the collector.

Steps to reproduce this error:

  1. Run Snap:
    snapd -l 1 -t 0
  2. Load collector plugin (tested with iostat, ethtool)
    snapctl plugin load snap-plugin-collector-iostat/build/rootfs/snap-plugin-collector-iostat
  3. 'Accidentally' load collector plugin once again
    snapctl plugin load snap-plugin-collector-iostat/build/rootfs/snap-plugin-collector-iostat
  4. Load mock-file-publisher and processor-passthru
  5. Create a task:
    iostat.txt

Result

Task is created but does not collect metrics.

@IRCody IRCody added the type/bug label Aug 8, 2016
@IRCody
Copy link
Contributor

IRCody commented Aug 8, 2016

I was able to reproduce this on master so labeling as a bug. Haven't been able to identify the exact cause yet but looking into it.

@lynxbat
Copy link
Contributor

lynxbat commented Aug 8, 2016

Nice catch @mkuculyma. This may be the best bug this quarter.

@IRCody
Copy link
Contributor

IRCody commented Aug 8, 2016

Looking at it I think it's related to this line. A reference to the loaded plugin is added to the metric catalog before we verify if a plugin with a matching key is already loaded. For metrics it allows multiple writes with the same metrics, but for plugins it does not allow it so it happily overwrites the metrics in the catalog (and the plugin associated with them). The plugin it saves there ends up erroring because it is already loaded, and it's executable is removed.

When the task is created we look at the metric catalog and gather the removed plugin's info from it, which gives the error: Error creating task:open /tmp/786791258/snap-plugin-collector-iostat: no such file or directory.

marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Oct 13, 2016
marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Oct 25, 2016
marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Oct 25, 2016
marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Oct 28, 2016
marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Oct 28, 2016
marcin-krolik added a commit to marcin-krolik/snap that referenced this issue Nov 17, 2016
…ailure

Proper copy of config policy

Deep copy of node rules

removed rules slice allocation and index
marcin-krolik added a commit that referenced this issue Nov 17, 2016
(SDI-1827): Fix #1128 Loading collector twice causes task failure
jcooklin pushed a commit to jcooklin/snap that referenced this issue Nov 17, 2016
…ailure

Proper copy of config policy

Deep copy of node rules

removed rules slice allocation and index
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