Skip to content

gbrain get/query spin at ~100% CPU after printing output (never exit) on PGLite — v0.37.2.0 #1247

@LucianaCedalio

Description

@LucianaCedalio

Summary

On a PGLite brain, gbrain get <slug> and gbrain query <question> print their output correctly and promptly, then the process spins at ~95-98% CPU and never exits. It has to be killed (Ctrl-C / SIGKILL). Other commands exit cleanly.

Environment

  • gbrain 0.37.2.0 (installed via bun install -g github:garrytan/gbrain, commit 9a4ae09)
  • Engine: PGLite
  • macOS (Darwin 25.3.0), bun 1.3.12, node 20.20

Repro

  1. PGLite brain with content (here: 25 pages, 26 embedded chunks).
  2. gbrain get <any-slug> → prints the page body, then hangs.
  3. gbrain query "<any question>" → prints ranked results (with scores), then hangs.

Observed two separate runs:

  • gbrain get <slug> — printed the page, then sat at 93.3% CPU for 2+ minutes until SIGKILL.
  • gbrain query "<q>" — printed ranked results, then sat at 98.0% CPU for 74s+ until SIGKILL.

In both cases the actual output is produced quickly; the spin happens after output, which looks like a post-completion / shutdown loop that never releases.

Not affected

gbrain doctor, stats, extract, list, embed --stale, config set, apply-migrations all run and exit cleanly on the same brain.

Possibly related

#1065 (embed hang on PGLite) — but distinct: that one reportedly never sent requests; here the command completes its output and then spins.

Impact

The two primary read commands are unusable in scripts (must SIGKILL, non-zero exit) and require a manual Ctrl-C after results appear in interactive use.

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