Repository navigation
THRIFT-6467: Wait the full timeout below one second in the Lua sockets - #4064
Merged
Merged
Conversation
Client: lua socket_wait() and l_socket_create_and_connect() computed their deadline from the millisecond timeout with an integer division by 1000, so a timeout below one second expired at once and the fraction of any longer one was dropped. Both now compute the deadline in fractional seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
socket_wait()inlib/lua/src/usocket.candl_socket_create_and_connect()inlib/lua/src/luasocket.ccomputed their deadline astimeout/1000, with the timeout anintin milliseconds. A timeout below one second therefore expired at once, and the fraction of a longer one was dropped. Both now compute the deadline in fractional seconds (timeout / 1000.0).New test
lib/lua/test/test_socket_timeout.lua, run bymake check. It timesaccept()on a server socket with a timeout of 500 ms and of 1500 ms, andTSocket:open()retrying a refused connection with 500 ms. On master the waits were 0.002 s, 1.004 s and 0.104 s; with the change they are 0.503 s, 1.505 s and 0.503 s.It is the first script in
lib/lua/testthat loads the built C modules, so the comment on the lib-lua step in.github/workflows/build.ymlis updated (comment only).Checked with the lib-lua CI steps under Lua 5.3 and 5.4:
make,make check, and the lua-to-lua cross test.Apache Jira ticket: THRIFT-6467
The title follows "THRIFT-NNNN: describe my issue"
One commit
No breaking change
🤖 Generated with Claude Code