BUG/MEDIUM: lua: fix wakeup condition from sleep()
authorWilly Tarreau <w@1wt.eu>
Thu, 30 Sep 2021 14:12:31 +0000 (16:12 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 Oct 2021 16:07:20 +0000 (18:07 +0200)
commit3083c49d65ab9dde5808781751afe2d47db521fc
tree05587c73fa4a1a3e56b0c62998f28fa39c5b108a
parent9bc5bcb0abf4b41097789c5ce9e1b03d35dd4e9a
BUG/MEDIUM: lua: fix wakeup condition from sleep()

A time comparison was wrong in hlua_sleep_yield(), making the sleep()
code do nothing for periods of 24 days every 49 days. An arithmetic
comparison was performed on now_ms instead of using tick_is_expired().

This bug was added in 1.6-dev by commit 5b8608f1e ("MINOR: lua: core:
add sleep functions") so the fix should be backported to all stable
versions.

(cherry picked from commit 12c02701d304f29ca74f521cfcc5fe1bc6f3e03d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 9cc2e4c9962bf83a0d08629444848f3ddae64473)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/hlua.c