graphiti icon indicating copy to clipboard operation
graphiti copied to clipboard

Bug: Timeout when adding episodes

Open sk365 opened this issue 7 months ago • 5 comments

Using your MCP server under Docker in a Libre Chat environment, I all too frequently run into timouts when adding new episodes even with very short episodes of 100 or so tokens.

Strangely, adding even much logger episodes works fine with the first request after starting docker containers. But all subsequent calls even for very short additions fail due to timeout.

Please help.

error message, docker-compose.yml and librechat.yaml pasted in below.

chat-api          | 2025-05-20T13:33:38.597Z debug: [MCP][User: 681b0ec0eb5b9c8d0a3df978] Updated last activity timestamp: 2025-05-20T13:33:38.597Z
chat-api          | 2025-05-20T13:33:38.597Z debug: [MCP][User: 681b0ec0eb5b9c8d0a3df978][graphiti] Reusing active connection
chat-api          | 2025-05-20T13:33:38.597Z debug: [MCP][User: 681b0ec0eb5b9c8d0a3df978] Updated last activity timestamp: 2025-05-20T13:33:38.597Z
chat-api          | 2025-05-20T13:33:38.597Z debug: [MCP][User: 681b0ec0eb5b9c8d0a3df978][graphiti] Transport sending: {"method":"tools/call","params":{"name":"add_episode","arguments":{"name":"test","e... [truncated]
chat-api          | 2025-05-20T13:34:38.599Z debug: [MCP][User: 681b0ec0eb5b9c8d0a3df978][graphiti] Transport sending: {"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":5,"reason... [truncated]
chat-api          | 2025-05-20T13:34:38.600Z error: [MCP][User: 681b0ec0eb5b9c8d0a3df978][graphiti][add_episode] Tool call failed MCP error -32001: Request timed out
chat-api          | 2025-05-20T13:34:38.601Z error: [MCP][User: 681b0ec0eb5b9c8d0a3df978][graphiti] Error calling "add_episode" MCP tool: MCP error -32001: Request timed out

NB: There are no log entries for the mcp-container upon such incidents.

docker-compose.yml

  neo4j:
    image: neo4j:5.26.0
    ports:
      - "7474:7474" # HTTP
      - "7687:7687" # Bolt
    environment:
      - NEO4J_AUTH=neo4j/demodemo
      - NEO4J_server_memory_heap_initial__size=512m
      - NEO4J_server_memory_heap_max__size=1G
      - NEO4J_server_memory_pagecache_size=512m
    volumes:
      - ./data/neo4j_data:/data
      - ./data/neo4j_logs:/logs
    healthcheck:
      test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:7474"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
    networks:
      - mcp-network 


  graphiti-mcp:
    build:
      context: ./mcp-server/graphiti
      dockerfile: Dockerfile 
    env_file:
      - path: .env
        required: false # Makes the file optional. Default value is 'true'
    depends_on:
      neo4j:
        condition: service_healthy
    environment:
      - NEO4J_URI=bolt://neo4j:7687
      - NEO4J_USER=neo4j
      - NEO4J_PASSWORD=demodemo
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - MODEL_NAME=${GRAPHITI_MODEL_NAME}
      - PATH=/root/.local/bin:${PATH}
    ports:
      - "8000:8000" # Expose the MCP server via HTTP for SSE transport
    command: ["uv", "run", "graphiti_mcp_server.py", "--transport", "sse"]
    networks:
      - mcp-network 

librechat.yml

  graphiti:
    type: sse
    url: "http://graphiti-mcp:8000/sse" # URL zum graphiti-mcp Container und Port 8000 mit SSE Pfad
    messagePath: "/message" 
    ssePath: "/sse"       
    logLevel: "info"     
    cors: true           
    timeout: 120000

sk365 avatar May 19 '25 15:05 sk365

I'm using MCP with a local running instance (python) and Neo4J locally and have also this issue. From the perspective of the MCP tool use / editor / LLM, it also leads to a timeout. See https://github.com/getzep/graphiti/issues/507 for more details (logs etc)

TechupBusiness avatar May 20 '25 11:05 TechupBusiness

When was the last time you pulled fro the main graphiti branch?

prasmussen15 avatar May 20 '25 15:05 prasmussen15

Yesterday

Am 20.05.25, 17:03 schrieb Preston Rasmussen

When was the last time you pulled fro the main graphiti branch?

sk365 avatar May 20 '25 17:05 sk365

I still have this when running it locally. It adds the first episode properly but then it does not close the add episode action and when I try to add another episode i will receive a timeout error.

"If you trigger a second run before seeing that final completion log (and the SSE close), you’ll run into the same “connection in use” or reset errors. Either wait for the community step to finish, or refactor so each upload request uses its own fresh SSE endpoint (or spin up multiple Uvicorn workers) to allow truly parallel uploads."

Can you help me on this one?

ncrimi avatar May 22 '25 12:05 ncrimi

I believe I addressed this yesterday in #512. Please would you pull the latest from the main branch and let us know how you do?

danielchalef avatar May 22 '25 19:05 danielchalef