Skip to content

🚨 [CRITICAL] Dual Redis Connection Managers Cause Connection Waste & Silent Cache Failures #994

Description

@ayomideadeniran

Description

The backend has two separate Redis connection managers that create independent connections to the same Redis instance, wasting resources and causing silent cache failures.

Locations

  1. backend/src/services/redisService.js β€” Creates one Redis client with memory fallback
  2. backend/src/services/cacheService.js β€” Creates a second Redis client to localhost:6379

Issues

  • cacheService.js has its own Redis client connecting to localhost:6379 independently
  • cacheService.initialize() is never called in server.js, so it remains perpetually disconnected
  • Multiple files import cacheService.js (compileService.js, cacheInterceptor.js, various middleware) expecting it to work, but all cache operations silently fail
  • The compileService.js explicitly stubs out cache functions as no-ops because of this:
    async function storeCacheEntry(_entry) { /* no-op */ }
    async function invalidateCache(_opts) { /* no-op */ }

Impact

  • Compilation cache is supposed to persist using Redis but instead relies solely on in-memory LRU
  • LRU cache is lost on server restart, forcing recompilation of all contracts
  • All search/facet/autocomplete caching silently fails
  • Two connections to Redis when only one is needed

Required Fix

  1. Merge cacheService.js functionality into redisService.js or eliminate the duplicate
  2. Replace compileService stub cache functions with real implementations using redisService
  3. Call cacheService.initialize() in server startup if keeping it separate

Reference

Identified during full codebase audit of soroban-playground.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related issuesbugSomething isn't workingcachingPerformance optimizationperformancePerformance optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions