Skip to content

[bug] evalScript does not recover from NOSCRIPT after Redis script cache flush #16

@KONFeature

Description

@KONFeature

evalScript caches script SHAs in a WeakMap per Redis client and never invalidates them. Redis's script cache is in-memory only (not persisted by RDB/AOF, not replicated under effects-replication), so any Redis restart, failover, or SCRIPT FLUSH leaves every cached SHA stale. Subsequent evalsha calls throw NOSCRIPT until the Node process is restarted.

Repro

  1. Enqueue a job (loads scripts)
  2. redis-cli SCRIPT FLUSH
  3. Enqueue another → NOSCRIPT No matching script, never recovers

Impact

Hit this in prod on self-hosted OpenPanel: GKE rescheduled the Redis pod, /track served 500s for hours while /healthcheck (PING-only) stayed green. Only fix was manual kubectl rollout restart.

Fix

Catch NOSCRIPT in evalScript, drop the cached SHA, reload, retry once. Same pattern ioredis/BullMQ use. Happy to PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions