Skip to content

gbrain embed hangs indefinitely on PGLite - no HTTP requests sent #1065

@SunOpt

Description

@SunOpt

Bug Description

gbrain embed (both --stale and --all) hangs indefinitely on PGLite backend without making any HTTP requests to the embedding provider. The process runs for 90+ seconds with zero output and zero network activity, then requires SIGTERM to kill. gbrain dream --dry-run correctly detects unstale chunks, but the actual embed execution deadlocks internally.

Environment

  • gbrain version: 0.35.1.0
  • OS: macOS 12.7.6 (Intel Core i7-6700HQ)
  • Backend: PGLite (~/.gbrain/brain.pglite)
  • Embedding providers tested: Ollama (nomic-embed-text), MiniMax (embo-01), custom OpenAI-compatible proxy → all same behavior
  • Installation method: bun add -g gbrain

Steps to Reproduce

  1. Have a brain with unstale chunks (any page with embeddings not yet generated):

    gbrain dream --dry-run  # confirms N chunks pending embed
  2. Run embed:

    gbrain embed --stale
    # or
    gbrain embed --all
  3. Observe: process hangs with no output. No HTTP requests reach the embedding provider (verified via proxy logs and network monitoring).

  4. SIGTERM required to stop the process (kill <pid>).

Expected Behavior

gbrain embed --stale should iterate through unstale chunks, send embedding requests to the configured provider, and update the vector index in PGLite.

Actual Behavior

Process hangs silently. Key observations:

  • No HTTP requests are ever sent — verified with a local proxy (http://localhost:4000) that logs every incoming request. Zero requests logged.
  • No stdout/stderr output — not even progress indicators or error messages.
  • gbrain dream --dry-run works correctly — it detects the unstale chunks, so the database query path is functional.
  • Same behavior across all providers — Ollama (local), MiniMax (remote), and a custom OpenAI-compatible proxy all exhibit identical behavior, ruling out provider-specific issues.
  • PGLite-specific — this appears to be a deadlock or blocking issue in the PGLite embed execution path.

Additional Context

  • gbrain doctor and gbrain stats work normally on the same PGLite database.
  • gbrain search (keyword/tsvector) works fine.
  • The issue is not a provider timeout — no requests leave the process at all.
  • Previous attempts included splitting large pages into smaller ones (2-3 chunks each) to rule out payload size issues — same result.
  • Multiple Ollama restarts and full system reboots were attempted — no change.

Workaround

None found. Keyword search (gbrain search) works, but semantic/vector search is unavailable until embed completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions