bhuvan-somisetty opened a new pull request, #13970:
URL: https://github.com/apache/apisix/pull/13970
### Description
send_syslog_data() in apisix/plugins/syslog/init.lua fetches the logger
instance from the lrucache and correctly checks whether it failed:
if not logger then
res = false
err_msg = "failed when initiating the sys logger processor".. err
end
When logger_socket.new(...) fails, for example due to a bad host or port or
a socket error, logger is nil and this branch correctly builds an error
message, but it never returns. Execution falls through to the very next line,
logger:log(log_message), which indexes a nil value. This throws an uncaught Lua
runtime error inside the log phase batch processor callback instead of
returning the already built false, err_msg back to the caller, the same way the
function already does for the logger:log() failure case right below it.
This PR adds the missing return so a failed logger init is reported as a
clean batch processor error instead of crashing the log phase.
#### Which issue(s) this PR fixes:
Fixes #13969
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [x] I have updated the documentation to reflect this change
- [x] I have verified that this change is backward compatible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]