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

cb_exit updates #31

Merged
merged 1 commit into from
Sep 3, 2015
Merged

cb_exit updates #31

merged 1 commit into from
Sep 3, 2015

Conversation

hasegaw
Copy link
Contributor

@hasegaw hasegaw commented Sep 3, 2015

I noticed cb_exit callbacks are not called if I hit Ctrl-C.
This change adds signal handler to catch exit events to resolve the issue.

in_serial plugin uses cb_exit to restore original termios.

@edsiper
Copy link
Member

edsiper commented Sep 3, 2015

thanks for catching this, comments:

  • for the engine modification I think the right way to do it is to implement the signal handlers on fluent-bit.c, otherwise when using fluent-bit in shared library mode we are setting a signal handler that commonly is set on the caller (e.g: examples/hello_world). So when the signal is trapped we can just dispatch a:
flb_lib_stop(config);

note: fluent-bit.c is not using the library API, it should.

@edsiper
Copy link
Member

edsiper commented Sep 3, 2015

after a re-review of the current fluent-bit.c and lib mode..

fluent-bit.c should not use the library mode, because that one spawn a thread to make its job. So the only improvement would be to add the signal handler that implements a cleanup doing:

flb_engine_flush(config, NULL);
flb_input_exit_all(config);
flb_output_exit(config);

@hasegaw
Copy link
Contributor Author

hasegaw commented Sep 3, 2015

Aha, make sense to me. Thanks for the comment.

Signed-off-by: Takeshi HASEGAWA <hasegaw@gmail.com>
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 this pull request may close these issues.

2 participants