Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filebeat gets restarted on every hook #18

Closed
axinojolais opened this issue Dec 22, 2017 · 1 comment · Fixed by #19
Closed

filebeat gets restarted on every hook #18

axinojolais opened this issue Dec 22, 2017 · 1 comment · Fixed by #19

Comments

@axinojolais
Copy link
Contributor

There's a pretty nasty bug hidden in this layer. Here's how it goes, please bear with me :

  1. render_without_context() is called (from the "main" charm, typically - filebeat in my case)
  2. context = config() is run. context is now a reference to a Config object.
  3. If you have set the logpath config option, then context['logpath'] = context['logpath'].split(' ') is run, which modifies context
  4. Because the Config class constructor contains atexit(self._implicit_save) (and because the implicit_save class attribute of the Config class defaults to true), the modified context is saved to disk as the new config
  5. When the next hook is run, the basic layer compares the current config and the config saved to disk, finds they're different, and sets the config.changed flag
  6. This layer sets beat.render
  7. The charm renders the config and restarts filebeat

I'm submitting a PR to fix.

@axinojolais
Copy link
Contributor Author

This also resolves canonical/layer-filebeat#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant