Skip to content

THRIFT-6467: Wait the full timeout below one second in the Lua sockets - #4064

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6467
Oct 29, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6467

Conversation

@Jens-G

@Jens-G Jens-G commented Oct 29, 2026

Copy link
Copy Markdown
Member

socket_wait() in lib/lua/src/usocket.c and l_socket_create_and_connect() in lib/lua/src/luasocket.c computed their deadline as timeout/1000, with the timeout an int in 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 by make check. It times accept() on a server socket with a timeout of 500 ms and of 1500 ms, and TSocket: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/test that loads the built C modules, so the comment on the lib-lua step in .github/workflows/build.yml is 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

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>
@Jens-G
Jens-G requested review from fishy and jimexist as code owners October 29, 2026 10:20
@mergeable mergeable Bot added lua Pull requests that update Lua code build and general CI cmake, automake and build system changes github_actions Pull requests that update GitHub Actions code labels Oct 29, 2026
@Jens-G
Jens-G merged commit dcaf92b into apache:master Oct 29, 2026
89 checks passed
@Jens-G
Jens-G deleted the THRIFT-6467 branch October 29, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build and general CI cmake, automake and build system changes github_actions Pull requests that update GitHub Actions code lua Pull requests that update Lua code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant