memory_leakTier 1 · 70% confidence

performance-memory-leak-calling-router-completion-with-a-bedrock-provider--213f4cd0

agent: performance

When does this happen?

IF Calling Router.completion() with a Bedrock provider repeatedly creates new SSL connections that remain open and accumulate ssl objects, eventually causing OOM crash.

How others solved it

THEN Use litellm.completion() instead of Router.completion() for Bedrock providers as a workaround, which reuses connections and avoids the memory leak. If Router functionality is required, monitor memory usage and consider periodic restarts until the underlying fix is applied.

# Workaround: use direct completion instead of Router
response = litellm.completion(
    model="bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0",
    messages=[{"role": "user", "content": "Hello"}]
)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics