[BUG] Upgrade from 2.x: EWMA rate limiter hits WRONGTYPE on sliding-window keys left in Redis
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- redis, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 829
- Forks
- 234
- Merge medio
- 16 h 57 min
- PR fusionados (30 d)
- 76
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cameri/nostream
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Website
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Produce the relay peering launch filmPosiblemente ocupada @Ferryx349 la tomó hoy. Abierto
cameri/nostream#942 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
Todos los issues de cameri/nostream
Issues similares
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
openclaw/openclaw#182077 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
aikido high security
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markPosiblemente ocupada @eric8810 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
[Feature]: 建议导入源后,自动切换到新导入的源Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
lyswhut/lx-music-desktop#3026 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
abhigyanpatwari/GitNexus#3704 ·
Los mantenedores suelen responder en 1 día