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: ensure timeout not nil to avoid attempt to perform arithmetic on a nil value error #214

Merged
merged 4 commits into from
Apr 7, 2024

Conversation

nic-chen
Copy link
Collaborator

@nic-chen nic-chen commented Apr 4, 2024

error logs:
image

The cause of the issue is that in the function refresh_jwt_token, the parameter timeout of semaphore wait directly uses the parameter passed by the caller without considering that the timeout parameter may be nil. If the caller does not pass the parameter timeout, this error will be triggered:

image

image

image

The timeout passed to the function refresh_jwt_token is basically self.timeout:

image
image
image

Since the timeout passed to the function refresh_jwt_token is basically self.timeout, we make a judgment on the timeout parameter in refresh_jwt_token, If it is nil, just use self.timeout, if self.timeout is nil too, just use 0, to ensure the timeout is not nil to avoid the error.

lib/resty/etcd/v3.lua Outdated Show resolved Hide resolved
Co-authored-by: AlinsRan <[email protected]>
@nic-chen nic-chen merged commit 5f883c0 into master Apr 7, 2024
5 checks passed
@nic-chen nic-chen deleted the fix/wait-on-nil branch April 7, 2024 02:12
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