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

filter_lua: validate lua function #600

Merged
merged 1 commit into from May 23, 2018
Merged

Conversation

nokute78
Copy link
Collaborator

filter_lua will be panic if call absent lua function.

how to reproduce

fluent-bit tries to call function no_such_func , but it is not defined.
fluent-bit will exit like this.

$ bin/fluent-bit -i dummy -F lua -p script=../scripts/test.lua -p call=no_such_func -m '*' -o null
Fluent-Bit v0.14.0
Copyright (C) Treasure Data

[2018/05/23 13:47:32] [ info] [engine] started (pid=28543)
PANIC: unprotected error in call to Lua API (attempt to call a nil value)

My patch is to validate lua function.
If it is invalid, fluent-bit ignores filter_lua and process other plugins.

$ bin/fluent-bit -i dummy -F lua -p script=../scripts/test.lua -p call=no_such_func -m '*' -o null
Fluent-Bit v0.14.0
Copyright (C) Treasure Data

[2018/05/23 13:45:02] [ info] [engine] started (pid=27909)
[2018/05/23 13:45:02] [error] [filter_lua] function no_such_func is not found
[2018/05/23 13:45:02] [error] Failed initialize filter lua.0

Signed-off-by: Takahiro YAMASHITA <nokute78@gmail.com>
@edsiper edsiper merged commit 3a72c9d into fluent:master May 23, 2018
@edsiper
Copy link
Member

edsiper commented May 23, 2018

thanks!

@nokute78 nokute78 deleted the validate_lua_func branch April 13, 2020 04:49
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.

None yet

2 participants