Skip to content

mod_dav: Use one clock for lock timeouts - #1107

Merged
arturobernalg merged 1 commit into
apache:trunkfrom
arturobernalg:fix/dav-timeout-one-clock
Nov 27, 2026
Merged

arturobernalg merged 1 commit into
apache:trunkfrom
arturobernalg:fix/dav-timeout-one-clock

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

#920 took "now" for the lock expiry from apr_time_now(), while the expiry check and the LOCK response's remaining time still use time(NULL). On Linux time(NULL) can lag gettimeofday() by up to a clock tick, so a LOCK right after a second boundary got one extra second: a "Second-0" lock reported "Second-1" or was still held (423).

This goes back to time(NULL), as on 2.4.x, keeping the overflow capping. test_dav_004_01/02 now accept one second less, and test_dav_004_04 locks repeatedly across second boundaries (fails without the fix, passes with it).

Seen by @ylavic in CI on #1105. cc @notroj

Follow-up to #920 (BZ 65788), trunk only; no CHANGES entry needed.

f33eb04 (apache#920) took "now" for the lock expiry in
dav_get_timeout_string() from apr_time_now(), while the expiry check
and the remaining time in the LOCK response still use time(NULL).  On
Linux time(NULL) can lag gettimeofday() by up to a clock tick, so a
LOCK handled right after a second boundary got an expiry one second
later than asked: a "Second-0" lock reported "Second-1" or was still
held (423).

Go back to time(NULL), as on 2.4.x, keeping the overflow capping.
Let test_dav_004_01/02 accept one second less, since a second may
tick between the LOCK and its response, and add a test locking
repeatedly across second boundaries.

@ylavic ylavic left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, thanks!

@arturobernalg
arturobernalg merged commit 2fa4630 into apache:trunk Nov 27, 2026
45 of 46 checks passed
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.

3 participants