Graph thread always at 100% CPU #1440

Open
opened 2026-01-04 15:58:26 +00:00 by icetan · 0 comments
icetan commented 2026-01-04 15:58:26 +00:00 (Migrated from github.com)

I'm having this issue where just running any mach program spawns a thread that is constantly at 100% CPU.

See the first process in this screenshot of htop:

I traced it to the Graph.processThread function that seems to be busy waiting on operations from the queue.

I made a naive patch that uses a Futex.wait that latches after each time the queue has been emptied and any time something pushes to the queue it wakes to start emptying the queue again.

This is how htop looks after applying the patch:

I'm having this issue where just running any mach program spawns a thread that is constantly at 100% CPU. See the first process in this screenshot of `htop`: <img src="https://txt.icetan.org/CBUne2gxD4CdMCsG.png"/> I traced it to the `Graph.processThread` function that seems to be busy waiting on operations from the queue. I made a naive [patch](https://github.com/icetan/mach/commit/1165403a0d5fdcea9c8082d67664903420ff29c6) that uses a `Futex.wait` that latches after each time the queue has been emptied and any time something pushes to the queue it wakes to start emptying the queue again. This is how `htop` looks after applying the patch: <img src="https://txt.icetan.org/8PSRrTcdUPDr_gdk.png"/>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1440
No description provided.