Agents view can exhaust file descriptors while scanning growing subagent sessions #1536
Replies: 1 comment
|
I reproduced the same failure shape on Prime Agent During a depth-2 RLM workload, one isolated worker reached:
Handles advanced, closed, and were reused, but new scans were admitted faster than they completed. Attach timed out. One named The current path is:
This independently validates the snapshot/single-flight direction in #1535. It also supports bounding the caller: allow at most one worker-summary refresh in flight, retain one dirty/trailing refresh, skip resident edges before transcript I/O, and single-flight The affected journals contain private data, so I am providing only aggregate |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When the agents view refreshes while multiple subagents continuously append to their session JSONL files, Prime Agent can consume sustained CPU, accumulate thousands of file descriptors, and eventually make the UI unresponsive.
Observed behavior
On Linux with Node.js 22, one affected process showed:
The subagent processes themselves were not consuming significant CPU.
Reproduction
Root cause
readSessionInfo()records the file size withstat(), but previously opened an unboundedcreateReadStream().For an actively growing file, the reader can continue following the moving EOF instead of completing. Because the metadata cache only stores completed scans, subsequent catalog refreshes start additional scans of the same file. This creates a feedback loop of overlapping streams, repeated parsing, and leaked descriptors.
Expected behavior
Each metadata scan should read a fixed snapshot of the file, and concurrent requests for the same snapshot should share one scan.
Proposed fix
I implemented and tested this in my fork:
VincentBailly#2
All reactions