Skip to content

fix(providers): increase HTTP connection pool for embedding provider #1124

Description

@ronaldtangg

Bug Report

App Version

v3.11.3

Description

When multiple concurrent requests (>5) trigger team_tasks(action="search"), all requests stuck indefinitely at the tool call. The system works normally with <5 concurrent requests but completely stalls under higher load.

Image

Error Log

No explicit error log. Requests hang indefinitely at team_tasks tool call.
Trace shows: tool_call team_tasks - status: running

Steps to Reproduce

  1. Deploy goclaw with embedding provider configured (OpenAI)
  2. Send 10+ concurrent chat requests that trigger team_tasks(action="search")
  3. Observe that requests 6+ hang indefinitely while requests 1-5 may complete

Expected Behavior

All concurrent requests should complete within reasonable time (~1-5 seconds for search).

Actual Behavior

  • Requests 1-2: Complete normally
  • Requests 3-5: Slow but complete
  • Requests 6+: Stuck indefinitely, never complete

Root Cause

The OpenAIEmbeddingProvider in internal/providers/embedding_openai.go uses a default http.Client without custom transport configuration:

client: &http.Client{Timeout: 60 * time.Second}

Go's default http.Transport has MaxIdleConnsPerHost: 2, causing HTTP connection pool starvation when multiple requests need to call the embedding API concurrently. Reference: https://github.com/golang/go/blob/master/src/net/http/transport.go#L62

Fix

Configure custom http.Transport with higher connection limits:

  client: &http.Client{
      Timeout: 60 * time.Second,
      Transport: &http.Transport{
          MaxIdleConns:        100,                                                                                                                                                                                                                                                                                                                                                                                              
          MaxIdleConnsPerHost: 30,
          IdleConnTimeout:     90 * time.Second,                                                                                                                                                                                                                                                                                                                                                                                 
      },                                                              
  },                                                                       

Additional Context

  • Affects any deployment using embedding provider for team task search
  • Connection pool exhaustion causes cascading failures as requests queue up
  • Each blocked request holds resources for up to 60 seconds (client timeout)

PR: #1123

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highData loss, core logic broken — fix in sprintagent:github-maintainProcessed by github-maintain automationarea:providersLLM provider implementationsarea:teamsAgent teams, tasks, dispatchbugSomething isn't workingmaintain:triagedTriaged by maintain workflow

    Type

    No type

    Fields

    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