FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(lock): stop the renewal goroutine on unlock by shepilov · Pull Request #4929 · linagora/cozy-stack · GitHub

fix(lock): stop the renewal goroutine on unlock - #4929

Merged
shepilov merged 2 commits into
masterfrom
fix/lock-renewer-shutdown
Oct 5, 2026
Merged

shepilov merged 2 commits into
masterfrom
fix/lock-renewer-shutdown

Conversation

shepilov commented Sep 17, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Problem

A job acquires a 20-second Redis lease at 0 seconds and finishes at 1 second.
The renewal goroutine is already waiting for the first tick at about 6.7 seconds.
Previously, Unlock() stopped the ticker without closing its channel, leaving that goroutine blocked forever.
The explicit shutdown signal now wakes it so it can exit.

Summary

  • End the long-operation renewal goroutine when Unlock() closes its shutdown channel. The goroutine stops its own ticker when it exits.
  • Serialize renewal with unlock and check the current acquisition so a ready tick cannot renew a released or reused lock. Add regression checks for goroutine exit, lock reuse, and a tick arriving during unlock.
  • Return the existing mutex directly for in-memory long operations, since those locks never expire and need no renewal goroutine.

Comment thread pkg/lock/lock.go
Comment thread pkg/lock/lock.go
Wake the renewer through an explicit shutdown channel and stop its ticker
when it exits. Serialize renewal with unlock and reject stale acquisitions
to prevent renewal after release.
shepilov force-pushed the fix/lock-renewer-shutdown branch from f99a497 to ff93ade Compare October 2, 2026 15:14
shepilov merged commit 116e459 into master Oct 5, 2026
4 checks passed
shepilov deleted the fix/lock-renewer-shutdown branch October 5, 2026 12:49
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL