Skip to content

Bug: requests.post in utils/call_llm.py has no timeout, hangs indefinitely on slow/stuck upstream #196

Description

@chirag127

Problem

_call_llm_provider in utils/call_llm.py calls requests.post(...) with no timeout= kwarg, so a slow/stuck upstream (Ollama, XAI, OpenRouter, self-hosted) hangs the whole tutorial run forever. The except requests.exceptions.Timeout handler at line 120 is dead code.

Cite

utils/call_llm.py:104response = requests.post(url, headers=headers, json=payload)
utils/call_llm.py:120except requests.exceptions.Timeout: (unreachable).

Steps

  1. Set LLM_PROVIDER=OLLAMA, OLLAMA_BASE_URL=http://10.255.255.1:11434 (unroutable), OLLAMA_MODEL=llama3.
  2. python main.py --repo https://github.com/octocat/Hello-World.

Expected

Abort with timeout error after ~30s.

Actual

Process hangs indefinitely; only Ctrl-C exits.

Env

Python 3.10-slim (Dockerfile); requests>=2.28.0 (requirements.txt).

Fix

requests.post(url, headers=headers, json=payload, timeout=(10, 300)).

Thanks for maintaining The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions