Windows 11 (local_embedded, Python 3.14): event loop stalls up to ~14s, /health unresponsive, daemon intermittently dies with WinError 64 / 1225
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- postgresql, python
- Ambito
- backend, databases, observability
Direzione di ricerca
Start by tracing the /health handler and the hindsight.loop_watchdog event loop watchdog, then follow how main.py configures Uvicorn's loop on Windows. Check the earlier reports #3099 and #4420 for related behavior. Reproduce the stall with local embedding or reranking on Windows and determine whether the loop is blocked; done means /health stays responsive during the workload and daemon stop can identify its daemon.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- hindsight-api / hindsight-embed 1.2.1 (via
uvx), modelocal_embedded, embedded pg0 PostgreSQL 18.1 - Windows 11 Home 10.0.26300, CPython 3.14.x (uv-managed)
- LLM provider:
claude-code(claude-haiku-5-5); local embedding + reranker models (CPU) - Daemon port 9177,
--idle-timeout 300(later 0) - Used by two clients at once: Hermes plugin and an OpenCode MCP client on the same bank
What happens
The daemon stops answering /health for several seconds to minutes and sometimes dies. Over the last week it was restarted by hand or by a watchdog roughly daily (start events in log: 11/11, 11/12, 11/16 x3, 11/17 x3).
1. Event loop blocked, /health stalls (2026-11-17 13:01)
WARNING hindsight.db.pool - slow DB pool acquire: waited 12.614s for a connection (in_use=1 max=100 idle=4 waiting=1)
WARNING hindsight.loop_watchdog - EVENT LOOP BLOCKED for >= 1.00s (13.91s and counting). ... /health cannot be scheduled.
... asyncio\base_events.py _run_once
... asyncio\proactor_events.py line 327, in _loop_reading -> self._data_received(data, length)
... asyncio\windows_events.py line 501, in recv_into -> ov.WSARecvInto(conn.fileno(), buf, flags)
The sampled frame is in the Proactor transport, which may just be where the loop thread happened to be when sampled. I have not found what actually held the loop for 14 s. The DB pool was nearly idle (in_use=1-2 of 100), so the pool warnings look like a symptom of the stalled loop, not the cause.
2. Daemon death (2026-11-16 17:29)
WARNING asyncpg.pool - Failed to restore the pool connection floor; retrying
ERROR claude_agent_sdk._internal.query - Fatal error in message reader: Command failed with exit code 3221225786 (0xC000013A)
ERROR hindsight_api.worker.poller - Worker error in polling loop: ConnectionRefusedError: [WinError 1225]
OSError/ConnectionResetError: [WinError 64] The specified network name is no longer available
After this the embedded Postgres and the API were gone. 0xC000013A is STATUS_CONTROL_C_EXIT, so the console/process group was signalled. I do not know whether that was the cause or a consequence.
3. Related log noise
UnicodeEncodeError: 'charmap' codec can't encode character 'ổ'fromloggingwhen messages contain non-ASCII text (cp1252 stdout). Fixed locally withPYTHONIOENCODING=utf-8.temporal_extraction ... ValueError: too many values to unpack (expected 2, got 3)on every recall (treated as "no temporal constraint").hindsight_embed daemon stopreported "Could not find PID for port 9177 / Port is bound but no hindsight daemon could be identified" while the daemon was running, sostopdoes not work in that state.
Expected
/healthstays responsive while retain/recall/consolidation run, or at least does not die with the process.daemon stopfinds the daemon it started.
Workaround in use
A scheduled task that polls /health every 5 min and kills + restarts the process tree after two consecutive failures. winloop is also installed as the event loop policy as of the latest restart; I can't yet tell whether it fixes the stalls.
Questions
- Is the stall expected when local embedding/reranker or the
claude-codeprovider runs in-process on Windows? Should those run off the loop thread? - Is there a supported setting on Windows to use a selector/winloop loop in uvicorn, and does
--loopapply? - Related earlier reports: #3099 (/health killed by 2s timeout while the loop is blocked), #4420 (winloop executor path).
Relevant log excerpts (paths and username redacted) are attached below; the full log contains personal memory content so I have not posted it.
Log excerpts (redacted)
### hermes.log excerpt A: 2026-11-16 ~17:29 (daemon death)
Traceback (most recent call last):
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\windows_events.py", line 463, in finish_socket_func
return ov.getresult()
~~~~~~~~~~~~^^
OSError: [WinError 64] The specified network name is no longer available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\pool.py", line 564, in _maintain_min_size
await holder.connect()
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\pool.py", line 172, in connect
con = await self._pool._get_new_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\pool.py", line 655, in _get_new_connection
con = await self._connect(
^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connection.py", line 2498, in connect
return await connect_utils._connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<22 lines>...
)
^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connect_utils.py", line 1307, in _connect
raise last_error or exceptions.TargetServerAttributeNotMatched(
...<2 lines>...
)
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connect_utils.py", line 1278, in _connect
conn = await _connect_addr(
^^^^^^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connect_utils.py", line 1092, in _connect_addr
return await __connect_addr(params, True, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connect_utils.py", line 1162, in __connect_addr
tr, pr = await connector
^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\asyncpg\connect_utils.py", line 1004, in _create_ssl_connection
do_ssl_upgrade = await pr.on_data
^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\proactor_events.py", line 288, in _loop_reading
length = fut.result()
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\windows_events.py", line 807, in _poll
value = callback(transferred, key, ov)
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\windows_events.py", line 467, in finish_socket_func
raise ConnectionResetError(*exc.args)
ConnectionResetError: [WinError 64] The specified network name is no longer available
2026-11-16 17:29:48,406 - ERROR - claude_agent_sdk._internal.query - Fatal error in message reader: Command failed with exit code 3221225786 (exit code: 3221225786)
Error output: Check stderr output for details
2026-11-16 17:29:48,407 - WARNING - hindsight_api.engine.providers.claude_code_llm - Claude Code error (attempt 1/4): Command failed with exit code 3221225786 (exit code: 3221225786)
Error output: Check stderr output for details
2026-11-16 17:29:49,016 - ERROR - hindsight_api.worker.poller - Worker Pook error in polling loop: ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection
Traceback (most recent call last):
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\hindsight_api\worker\poller.py", line 1850, in _poll_loop
tasks = await self.claim_batch()
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\hindsight_api\worker\poller.py", line 601, in claim_batch
async with self._backend.acquire() as conn:
~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\contextlib.py", line 214, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\QZldA6UTh5oohZ1T\Lib\site-packages\hindsight_api\engine\db\postgresql.py", line 349, in acquire
### hermes.log excerpt B: 2026-11-17 13:01 (event loop blocked 13.9s)
2026-11-17 13:01:38,988 - WARNING - hindsight.db.pool - slow DB pool acquire: waited 12.614s for a connection (in_use=1 max=100 idle=4 waiting=1). The pool is likely saturated; /health can stall on connection acquisition while the event loop is free.
2026-11-17 13:01:41,490 - WARNING - hindsight_api.engine.db_utils - [DB POOL] Slow acquire: 12.615s
2026-11-17 13:01:41,491 - WARNING - hindsight.db.pool - slow DB pool acquire: waited 9.097s for a connection (in_use=2 max=100 idle=3 waiting=0). The pool is likely saturated; /health can stall on connection acquisition while the event loop is free.
2026-11-17 13:01:44,107 - INFO - hindsight_api.worker.poller - [WORKER_STATS] worker=Pook slots=0/10 | reserved: [consolidation=0/2(avail=2)] | shared=0/8(avail=8) | global: pending=0 (queried=0/1 schemas: ) | others: none | pool: size=5 limits=5-100 idle=5 in_use=0 free_holders=100 pending_acquires=0 | proc: unavailable | my_active: none
2026-11-17 13:01:46,554 - INFO - hindsight_api.engine.maintenance - Maintenance: scheduled mental model refresh took 20.180s
2026-11-17 13:01:46,562 - WARNING - hindsight.loop_watchdog - EVENT LOOP BLOCKED for >= 1.00s (13.91s and counting). The loop is not servicing coroutines ? /health cannot be scheduled. Blocking frame:
File "<frozen runpy>", line 203, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Scripts\hindsight-api.exe\__main__.py", line 10, in <module>
sys.exit(main())
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\hindsight_api\main.py", line 500, in main
uvicorn.run(**uvicorn_config)
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\uvicorn\main.py", line 632, in run
server.run()
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\uvicorn\server.py", line 86, in run
return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\runners.py", line 205, in run
return runner.run(main)
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\runners.py", line 128, in run
return self._loop.run_until_complete(task)
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\base_events.py", line 707, in run_until_complete
self.run_forever()
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\base_events.py", line 678, in run_forever
self._run_once()
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\base_events.py", line 2065, in _run_once
handle = None # Needed to break cycles when an exception occurs.
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\events.py", line 110, in _run
self = None # Needed to break cycles when an exception occurs.
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\proactor_events.py", line 327, in _loop_reading
self._data_received(data, length)
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\windows_events.py", line 501, in recv_into
ov.WSARecvInto(conn.fileno(), buf, flags)
2026-11-17 13:01:50,709 - WARNING - hindsight.db.pool - slow DB pool acquire: waited 4.156s for a connection (in_use=1 max=100 idle=4 waiting=0). The pool is likely saturated; /health can stall on connection acquisition while the event loop is free.
2026-11-17 13:01:55,274 - WARNING - hindsight.db.pool - slow DB pool acquire: waited 2.136s for a connection (in_use=1 max=100 idle=4 waiting=0). The pool is likely saturated; /health can stall on connection acquisition while the event loop is free.
2026-11-17 13:01:55,734 - WARNING - hindsight.loop_watchdog - EVENT LOOP BLOCKED for >= 1.00s (8.91s and counting). The loop is not servicing coroutines ? /health cannot be scheduled. Blocking frame:
File "<frozen runpy>", line 203, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Scripts\hindsight-api.exe\__main__.py", line 10, in <module>
sys.exit(main())
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\hindsight_api\main.py", line 500, in main
uvicorn.run(**uvicorn_config)
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\uvicorn\main.py", line 632, in run
server.run()
File "C:\Users\<user>\AppData\Local\uv\cache\archive-v0\0rD8F3aeap_fPaP4\Lib\site-packages\uvicorn\server.py", line 86, in run
return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
File "C:\Users\<user>\AppData\Roaming\uv\python\cpython-3.14-windows-x86_64-none\Lib\asyncio\runners.py", line 205, in run
return runner.run(main)
### excerpt C: after restart with winloop
2026-11-17 13:44:32,498 - WARNING - hindsight.loop_watchdog - EVENT LOOP BLOCKED for >= 1.00s (1.08s and counting). The loop is not servicing coroutines ? /health cannot be scheduled. Blocking frame:
2026-11-17 13:44:42,740 - WARNING - hindsight.loop_watchdog - EVENT LOOP BLOCKED for >= 1.00s (1.01s and counting). The loop is not servicing coroutines ? /health cannot be scheduled. Blocking frame:
- Lingua principale
- Python
- Stelle
- 45.2k
- Fork
- 5.9k
- Merge medio
- 6h 18m
- PR unite (30g)
- 354
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vectorize-io/hindsight
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vectorize-io/hindsight#6923 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vectorize-io/hindsight#6921 ·
I maintainer di solito rispondono entro 1 giorno
-
core
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
vectorize-io/hindsight#6910 ·
I maintainer di solito rispondono entro 1 giorno
-
core
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vectorize-io/hindsight#6903 ·
I maintainer di solito rispondono entro 1 giorno
-
integration:openclaw
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vectorize-io/hindsight#6893 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vectorize-io/hindsight
Issue simili
-
00 - Bug component: numpy.linalg
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
521xueweihan/HelloGitHub#4543 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
emeryberger/CSrankings#15700 ·
I maintainer di solito rispondono entro 2 giorni
-
Bug | 工作不正常 Triage | 待检查
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
I maintainer di solito rispondono entro 1 giorno
-
Task select patterns with uppercase letters never matchForse già presa @manobhisriram l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno