[BUG] Upgrade from 2.x: EWMA rate limiter hits WRONGTYPE on sliding-window keys left in Redis
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- redis, typescript
Piste de recherche
Start by tracing the EWMA rate limiter’s Lua script and the code that builds its Redis keys; the issue names the colliding connection and message key patterns. Check how the existing sliding-window strategy stores those keys and inspect the upgrade notes. Done means upgrading with legacy sorted-set keys no longer causes WRONGTYPE errors, with the behavior covered for both connection and message limits.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
After upgrading from 2.x with the existing cache volume, client workers log on every new connection/message:
uncaught error: [ErrorReply: WRONGTYPE Operation against a key holding the wrong kind of value script: <sha>, on @user_script:6.]
2.x used the sliding-window limiter, which stores ${remoteAddress}:connection:${period} and ${client}:message:${period} as sorted sets. Since #476 the default limits.rateLimiter.strategy is ewma, whose Lua script does HGET/HSET on the same key names. The old zset keys stay in Redis until their TTL expires (up to the longest configured period), and until then those clients hit the error path.
To Reproduce
- Run 2.x for a while (rate-limit keys accumulate in the
cachevolume). - Upgrade to 3.x keeping the volume, start the relay.
docker logs nostreamshows the WRONGTYPE errors above;redis-cli type <ip>:connection:<period>→zset.
Expected behavior
Upgrading does not require manual Redis cleanup.
System
- Version: 2.1.0 → 3.4.1, default
rateLimiter.strategy: ewma,redis:7.0.5-alpine3.16
Workaround we used
Delete only the conflicting legacy keys (7 058 in our case), after which the errors stopped:
for p in '*:connection:*' '*:message:*'; do
redis-cli -a "$REDIS_PASSWORD" --scan --pattern "$p" | while read k; do
[ "$(redis-cli -a "$REDIS_PASSWORD" type "$k")" = zset ] && redis-cli -a "$REDIS_PASSWORD" del "$k"
done
done
Suggestion
Either namespace the EWMA keys (e.g. ewma: prefix) so they cannot collide with sliding-window keys — this also helps when an operator switches strategy back and forth — or make the EWMA script self-healing:
if redis.call('TYPE', key).ok ~= 'hash' then redis.call('DEL', key) end
plus a line in the upgrade notes.
- Langage dominant
- TypeScript
- Étoiles
- 829
- Forks
- 234
- Merge moyen
- 16 h 57 min
- PR mergées (30 j)
- 76
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cameri/nostream
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
Website
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Les mainteneurs répondent en général sous 1 jour
-
Produce the relay peering launch filmPeut-être pris @Ferryx349 l’a pris aujourd’hui. Ouverte
cameri/nostream#942 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 28/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de cameri/nostream
Issues similaires
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
openclaw/openclaw#182077 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
aikido high security
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markPeut-être pris @eric8810 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: 建议导入源后,自动切换到新导入的源Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
lyswhut/lx-music-desktop#3026 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
abhigyanpatwari/GitNexus#3704 ·
Les mainteneurs répondent en général sous 1 jour