Skip to content

[stable35] fix(lock): stop overwriting a lock's creation time with the real clock - #1288

Merged
benjaminfrueh merged 1 commit into
stable35from
backport/1284/stable35
Sep 8, 2026
Merged

benjaminfrueh merged 1 commit into
stable35from
backport/1284/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 8, 2026

Copy link
Copy Markdown

Backport of PR #1284

LockService::lock() called setCreation(time()) right after building the
FileLock, overwriting the creation timestamp that FileLock's own
constructor had already set correctly via the injected ITimeFactory.
The extra call is redundant under normal operation, but it bypasses
whatever clock a test has mocked in.

That's what made testRemoveDeprecatedLocks flake in CI on MySQL and
Oracle: the test freezes the mocked clock and later advances it by
1801 seconds (one second past its 30-minute cutoff), but the lock's
actual creation time came from the real, unmocked clock a few
milliseconds later. Whenever wall-clock execution crossed a one-second
boundary between those two moments, creation ended up equal to the
cutoff instead of one second before it, and the strict "<" comparison
in getLocksOlderThan() excluded the lock from the deprecated set.
Reproduced locally by looping the lock/check cycle against real
PHP 8.5 + MySQL 8.4 until it failed, and confirmed creation and cutoff
landed on the exact same second each time.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

# Conflicts:
#	tests/Feature/LockFeatureTest.php
@backportbot
backportbot Bot requested review from solracsf and removed request for juliusknorr September 8, 2026 17:10
@backportbot backportbot Bot added this to the Nextcloud 35 milestone Sep 8, 2026
@benjaminfrueh
benjaminfrueh merged commit 952d6fc into stable35 Sep 8, 2026
46 checks passed
@benjaminfrueh
benjaminfrueh deleted the backport/1284/stable35 branch September 8, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants