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

Lifecycle method called correctly once #1242

Merged
merged 4 commits into from
Sep 28, 2016

Conversation

tagomoris
Copy link
Member

This change is to fix both of #1161 and #1222.

To fix #1222, RootAgent (and Agent) should not retrieve outputs of output plugins dynamically in #lifecycle. Removing it solves the problem to call shutdown methods twice.

But this fix re-opens #1161 problem.
If all plugins are flat/static plugins or MultiOutput plugins which initialize all stores by static configuration, all plugin instances are registered in agent.outputs.
But once MultiOutput plugin is initialized dynamically by any plugins (e.g., fluent-plugin-forest), its sub-store/sub-plugin instances are not registered in agent.outputs. Lifecycle methods of these plugins are never called.

This change will add a feature to call lifecycle methods in MultiOutput. It's a kind of dirty workaround, but works well.

* outputs of multi_output are added into @outputs, in #add_match
…eated/configured in dynamic way

* when plugins created dynamically, its child output plugins are not registered in agent, and out of #lifecycle target
* so these plugins should be controlled by MultiOutput plugins

This fix is for configurations using fluent-plugin-forest and similar plugins, with "copy" as its sub-store.
@tagomoris tagomoris added bug Something isn't working v0.14 labels Sep 26, 2016
@tagomoris
Copy link
Member Author

@repeatedly Could you review this change?

@repeatedly
Copy link
Member

repeatedly commented Sep 26, 2016

It seems good. Removing recursive_output_traverse.call(store) in lifecycle also resolves same log issue with copy_ex like v0.12 MultiOutput based plugin.

@@ -137,7 +131,12 @@ def add_match(type, pattern, conf)
@outputs << output
if output.respond_to?(:outputs) && (output.respond_to?(:multi_output?) && output.multi_output? || output.is_a?(Fluent::MultiOutput))
Copy link
Member

@repeatedly repeatedly Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another topic.
I noticed adding Fluent::MultiOutput's outputs seems wrong.
v0.12 MultiOutput calls plugin's start/shutdown directly, so
it causes double lifecycle sequence calls silently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looks right.

@tagomoris
Copy link
Member Author

@repeatedly updated this change.

@tagomoris
Copy link
Member Author

@repeatedly ping.

@repeatedly
Copy link
Member

LGTM

@tagomoris tagomoris merged commit 463ac14 into master Sep 28, 2016
@tagomoris tagomoris deleted the lifecycle-method-called-correctly-once branch September 28, 2016 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Methods for shutdown sequence called twice
2 participants