Render loop causes memory explosion and session hang (yoga layout engine)
Render loop causes memory explosion and session hang (yoga layout engine)
Environment
- Claude Code version: 2.1.20
- OS: RHEL 9 (Linux 5.14.0-570.58.1.el9_6.x86_64)
- Platform: CLI
Description
Claude Code sessions hang and become unresponsive after running for a few minutes. The process consumes 13-19GB of memory and 60-80% CPU before becoming completely unresponsive.
Root Cause Analysis
Debug logs show the yoga layout engine entering a render loop, generating over 1 million re-render calls in ~15 minutes:
grep -c "Layout engine: yoga" debug-file.txt
1116136
The debug log files grow to 50-300MB due to continuous logging of:
[DEBUG] Layout engine: yoga(1+ million times)[DEBUG] [ToolSearch:optimistic] mode=tst-auto, ENABLE_TOOL_SEARCH=undefined, result=true(thousands of times)
Reproduction
- Start a new Claude Code session
- Use the Task tool to spawn a subagent (e.g., jira-workflow)
- Session hangs within minutes
Interesting finding: An established/running session can spawn subagents without hanging. Only new sessions exhibit this behavior consistently.
Evidence from debug logs
Session start (normal):
2026-01-27T22:16:20.499Z [DEBUG] Failed to check enabledPlatforms: TypeError: undefined is not an object (evaluating 'd7.join')
2026-01-27T22:16:20.652Z [DEBUG] [init] configureGlobalAgents starting
2026-01-27T22:16:20.652Z [DEBUG] [init] configureGlobalAgents complete
Then continuous render loop (problematic):
2026-01-27T22:27:09.717Z [DEBUG] Layout engine: yoga
2026-01-27T22:27:09.717Z [DEBUG] Layout engine: yoga
2026-01-27T22:27:09.717Z [DEBUG] Layout engine: yoga
... (millions of times)
Process state when hung
ps aux | grep claude
root 1024325 58.5 54.2 86528256 13184556 pts/0 Rl+ 14:40 38:58 claude
- 58% CPU
- 54% memory (13GB on 24GB system)
- Process must be killed with
kill -9
Files available
Debug logs archived at: ~/.claude/debug-archive-2026-01-27/ (829MB total)
Largest files showing the issue:
17fbaea2-6696-4e52-8677-f7a5630ee02f.txt(323MB)5aad5024-b094-4637-84ee-fa126ad4d0cb.txt(186MB)082725b2-657b-42b3-8a19-5d74ae9d90cc.txt(58MB)
Workaround
The only workaround found is to use an already-running stable session rather than starting new sessions. Cleaning up debug logs before starting may also help.
Additional notes
- The
enabledPlatformsTypeError appears in ALL sessions but doesn't seem to be the direct cause - The render loop appears to be triggered during UI state updates related to tool search or task display
- MCP tools (Jira) work fine once the session is stable
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗