You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 Bug Report: Jobs worker stores its dedupe markers (jobs-event-*) in Redis without TTL #15746
A marker is removed by Redis after DEDUPE_TTL (3600 s), the window in which the worker uses it.
👎 Actual Behavior
The count only grows, every marker has TTL -1.
Cause: the worker checks a marker with $cache->load($key, self::DEDUPE_TTL) (Jobs.php L180) but stores it with $cache->save($key, true) (L255, L296). The Redis cache adapter only sets EXPIRE when save() gets a TTL; otherwise the envelope only expires logically when it is read. Keys in the format before 2.6.2 (jobs-event-<eventId>, without the project sequence) are never read again and stay as well.
Why it matters: each marker is a small hash (≈ 400 B), but there is one per log, artifact, exit and complete callback of every build. They are never read after an hour, yet they count against maxmemory like the cache and the queues that share the same Redis.
We found no open issue or PR about this.
🎲 Appwrite version
2.7.3 (measured on 2.7.2, code unchanged in 2.7.3)
💻 Operating system
Linux (Ubuntu 26.04), Docker
🧱 Your Environment
Self-hosted, Redis 7.4 with --maxmemory-policy allkeys-lru, shared by cache and queues as in the official compose file.
💡 Suggested fix
Pass the TTL when saving: $cache->save($key, true, ttl: self::DEDUPE_TTL) at both places.
Existing installations keep their old markers; a note in the release (or a one-off cleanup in the migration) would help.
👀 Have you spent some time to check if this issue has been raised before?
In src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php:
Dedupe markers are checked with a TTL window of self::DEDUPE_TTL (3600s) via $cache->load($key, self::DEDUPE_TTL) (L180).
However, when writing the markers at lines 255 and 296, $cache->save($key, true) does not pass ttl: self::DEDUPE_TTL.
As a result, the Redis cache adapter does not set an expiration (EXPIRE), causing build callback hashes (jobs-event-*) to persist indefinitely in Redis and needlessly consume memory.
Proposed Solution
Pass ttl: self::DEDUPE_TTL to $cache->save($key, true, self::DEDUPE_TTL) at L255 and L296 in Jobs.php.
Add test coverage verifying that dedupe marker saves pass self::DEDUPE_TTL.
Could you please assign this issue to me? Thank you!
I have submitted a PR fixing this by passing ttl: self::DEDUPE_TTL (3600s) when saving jobs-event-* markers in Jobs.php, along with unit test coverage: #15839
Activity
utkarshpatwa393-sys commentedon Nov 19, 2026
Hi team! 👋
I would love to work on this issue.
Root Cause
In
src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php:self::DEDUPE_TTL(3600s) via$cache->load($key, self::DEDUPE_TTL)(L180).$cache->save($key, true)does not passttl: self::DEDUPE_TTL.EXPIRE), causing build callback hashes (jobs-event-*) to persist indefinitely in Redis and needlessly consume memory.Proposed Solution
ttl: self::DEDUPE_TTLto$cache->save($key, true, self::DEDUPE_TTL)at L255 and L296 inJobs.php.self::DEDUPE_TTL.Could you please assign this issue to me? Thank you!
fix(functions): set TTL when saving jobs dedupe markers in Redis (app…
saiyyedfardeen commentedon Nov 19, 2026
I have submitted a PR fixing this by passing
ttl: self::DEDUPE_TTL(3600s) when savingjobs-event-*markers inJobs.php, along with unit test coverage: #15839fix(functions): set TTL when saving jobs dedupe markers in Redis (app…