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

fix: inappropriate default timeout of syslog schema #6807

Merged
merged 2 commits into from
Apr 11, 2022

Conversation

nic-6443
Copy link
Member

@nic-6443 nic-6443 commented Apr 8, 2022

Description

We use 3 as the default timeout configuration in the syslog plugin. This configuration will eventually be used as the timeout configuration of the lua-resty-logger-socket library, and its unit is milliseconds.

It is obviously inappropriate to use 3 milliseconds as the default configuration, because it is easy to trigger a timeout. I think the author of the syslog plugin should have mistakenly thought that the timeout unit in lua-resty-logger-socket is seconds, so 3 is used as the default value.

So this PR modifies the default value to 3000, and clarifies the timeout unit in the documentation.

timeout = {type = "integer", minimum = 1, default = 3},

local logger, err = core.lrucache.plugin_ctx(
lrucache, api_ctx, nil, logger_socket.new, logger_socket, {
host = conf.host,
port = conf.port,
flush_limit = conf.flush_limit,
drop_limit = conf.drop_limit,
timeout = conf.timeout,
sock_type = conf.sock_type,
pool_size = conf.pool_size,
tls = conf.tls,
}
)

https://github.com/cloudflare/lua-resty-logger-socket/blob/master/README.md?plain=1#L102-L104

timeout

Sets the timeout (in ms) protection for subsequent operations, including the connect method. Default value is 1000 (1 sec).

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

spacewander
spacewander previously approved these changes Apr 8, 2022
Copy link
Contributor

@starsz starsz left a comment

Choose a reason for hiding this comment

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

Good capture.

@nic-6443 nic-6443 merged commit 392f6c1 into apache:master Apr 11, 2022
@nic-6443 nic-6443 deleted the fix-syslog-default-timeout branch April 11, 2022 01:12
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request May 20, 2022
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.

5 participants