[BUG] Upgrade from 2.x: EWMA rate limiter hits WRONGTYPE on sliding-window keys left in Redis
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- redis, typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 829
- Forks
- 234
- Merge médio
- 16h 13min
- PRs com merge (30d)
- 74
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de cameri/nostream
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
Mantenedores costumam responder em até 1 dia
-
Website
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
Mantenedores costumam responder em até 1 dia
-
[BUG] LNbits >= 1.0: ISO 8601 time/expiry parsed as unix seconds, paid admissions never confirmedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
cameri/nostream#927 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
feat(payments): let clients see their subscription tierTalvez já em andamento @Priyanshubhartistm assumiu há 1 dia. Abertaenhancement
cameri/nostream#925 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de cameri/nostream
Issues semelhantes
-
createAI: the ai peer range allows ai@6, which the provider cannot work withTalvez já em andamento @akhil9tiet assumiu hoje. Abertabug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 83/100
cloudflare/agents#2690 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
[fullsend] E2E: theme — global-header ignores app.branding.fullLogo (RHDHBUGS-3670)Talvez já em andamento @fullsend-ai-coder assumiu hoje. Abertae2e-failure ready-to-code
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
redhat-developer/rhdh-plugin-export-overlays#4503 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
needs triage 📥
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
ethereum/ethereum-org-website#19601 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
cloudscape-design/components#5184 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
agilepathway/label-checker#805 ·
Mantenedores costumam responder em até 1 dia