You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ripgrep processes get stuck and consume 700% CPU, freezing entire system #9676
I was working on some Neovim config files when my laptop suddenly became extremely sluggish - like completely unusable. At first I thought it was a power management issue, but when I checked my processes, I found three ripgrep processes that had been running for almost 3 hours, each consuming around 230% CPU (680% total).
@hbouhadji yeah my poor laptop sounded like a jet plane. I couldn't figure out why my pc was going so damn slow, I first thought it was neovim cause when I closed it, the pc sped up but in reality opencode was being the bully with its search processes. I finally just removed opencode altogether because I ran into more bugs like this.
Same thing is happening to me. I know what I did, but I don't know how to resolve this. Ideally I'd like OpenCode to detect this situation and calm things down.
How I did this is that I accidentally opened OpenCode in my home folder. Therefore it's indexing many many GB of data, including my Steam library. Would appreciate instructions how to clean this up, currently it's thrashing my swap file, and destroying my SSD in the process. Innocently of course, a bug, but a super dangerous bug. My computer locks up every few minutes and kills processes.
top - 23:33:11 up 10 days, 16:24, 4 users, load average: 38.23, 33.59, 24.42 Threads: 2703 total, 38 running, 2603 sleeping, 62 stopped, 0 zombie %Cpu(s): 7.3 us, 91.9 sy, 0.0 ni, 0.1 id, 0.0 wa, 0.5 hi, 0.2 si, 0.0 st MiB Mem : 27827.5 total, 2553.4 free, 22532.3 used, 7480.2 buff/cache MiB Swap: 4096.0 total, 0.0 free, 4096.0 used. 5295.2 avail Mem PID USER PR NI VIRT RES
SHR S %CPU %MEM TIME+ COMMAND 2421608 chris 20 0 259196 21044 1368 R 79.7 0.1 2:34.88 rg 2421597 chris 20 0
263292 23064 1364 R 65.0 0.1 2:48.06 rg 2421610 chris 20 0 259196 21044 1368 R 60.8 0.1 2:51.56 rg 2421629 chris 20 0
267388 23236 1368 R 60.5 0.1 2:52.92 rg 2421613 chris 20 0 259196 21044 1368 R 50.8 0.1 2:51.80 rg 2421609 chris 20 0
259196 21044 1368 R 48.6 0.1 2:43.30 rg 2421598 chris 20 0 263292 23064 1364 R 47.9 0.1 2:53.24 rg 2421605 chris 20 0
259196 21044 1368 R 47.9 0.1 2:49.70 rg 2421592 chris 20 0 263292 23064 1364 R 46.3 0.1 2:47.77 rg 2421595 chris 20 0
263292 23064 1364 R 45.0 0.1 2:39.12 rg 2421614 chris 20 0 259196 21044 1368 R 44.7 0.1 2:52.00 rg 2421607 chris 20 0
259196 21044 1368 R 42.8 0.1 2:52.25 rg 2421611 chris 20 0 259196 21044 1368 R 41.5 0.1 2:50.31 rg 2421593 chris 20 0
Chiming in to say that I've experienced this issue too. I've been able to reproduce it fairly consistently like this:
Invoke opencode in my home directory (~)
Prompt with "find my opencode config"
The agent will then use the Glob tool (rg under the hood) search for some relevant patterns. The issue is that these processes occasionally run indefinitely and consume all available CPU resources
I have a link to a thread where this issue occurred. And htere are the full commands of the 3 rg processes that were spawned:
Glob works when invoked in a more specific directory like ~/.config, for example in this thread. So I guess this is fundamentally a performance issue with using rg in a directory that has lots of symlinks, mounted volumes or system drives.
I looked up the docs for tool configurations to see if there was any support for setting timeouts on tool calls (and sending a SIGTERM/SIGKILL for example), but so far found none. Not sure how feasible that would be to implement, but I feel it would be very useful
i have the same issue on my pop os 24.04, it didn't quite peg my cpu, but i was at 77% for minutes until i manually killed the ripgrep process, seems to me like rg or glob are the ones with an issue, is there a way to simply not allow it to use glob, even if it takes a few more tokens?
also seeing this on Arch and NixOS. I reduced the --max-filesize arg in .config/ripgrep/config to 1M (default is 10M) and I'm not seeing as persistent CPU spikes. Not sure if this affects --glob.
This is exactly the problem why.
FULL STOP (see what I did here 🤣). What are we doing? Why do we need to follow symlinks for Glob tool?
This can't be default behavior!
Instead, what should actually happen, in this order:
When Glob doesn't provide enough results, it's usually context problem. User didn't provide enough instructions or they're too vague. opencode can't be this smart and try follow symlinks. This is not a fix for self-induced error. "No results" for agent means either "I'm searching for a wrong file" or "file truly doesn't exist". And you have failure mode that you can recover from very easily: "try another pattern" or "follow up to user explaining the problem"
When opencode is used in the context of entire system (e.g. access to /), there should be a mechanism that either: blocks using --follow (why do you even need it if you can brute-force it with rg /), or uses sensible .rgignore / ripgreprc defaults.
Please, please don't make this even more cursed than that 🙏
Respect Linux defaults when using tools that interact with file system, they are for reasons.
There should be an escape hatch tho, for allowing certain symlinks to be traversed.
When working with Odoo, many modules are loaded into a project (odoo, enterprise, OCA modules etc...) and when using worktrees, it doesn't make sense to keep dozens of copies of each folder per project.
Symlinking is an easy solution for this, but that no longer works if you disable it entirely without any option to allow RG to follow certain symlinks
it just doesn't have to follow them automatically for that, if it gets back a symlink it will simply make another call to the location of the relevant symlink. I'd bet that's less token intensive than autoresolving them.
It seems to get stuck a lot on this for me.
It keeps searching with empty results, and then ends up using ls -la to traverse the files manually, wasting tons and tons of tokens and context, often still failing to find the right details.
I need it to be able to search and find results in symlinked folders, not just view a single symlinked file.
There should be an escape hatch tho, for allowing certain symlinks to be traversed. When working with Odoo, many modules are loaded into a project (odoo, enterprise, OCA modules etc...) and when using worktrees, it doesn't make sense to keep dozens of copies of each folder per project. Symlinking is an easy solution for this, but that no longer works if you disable it entirely without any option to allow RG to follow certain symlinks
@jeroenev This is already a "user-controlled" environment, for which I'd suggest writing/extending own Blob tool. It can be an option to toggle this in native tool but 100% must not be default behavior. If there's some setup that requires traversing symlinks to find things outside of the main folder, this already too complicated to handle properly.
Users should be empowered to write their own Glob patterns / folders, configurable or easily extensible. I suggest to try and write your own tool first. If this is a common use-case, it can be maintained.
Doesn't seem like an uncommon use-case to me, at least for many "module-based" codebases I would think this is fairly common use-case.
I understand that it's no longer the default, especially when users run opencode from their home directory
I think it makes sense to at least make --follow opt-in, for users who know what they're symlinking in their project (which I would suspect is the majority of projects).
It can be supported as followSymlinks: ["odoo", "enterprise", "oca", "path/to"], something like that. It must be configurable to explicitly allow following + there should be a mechanism that detects loops early and either stops until you fix it (UX-friendly) or simply ignores any symlinks deeper than 1 (not sure if possible).
E.g.
Found a symlink loop while indexing files:
./odoo/addons -> ../enterprise/addons -> ../odoo/addons
Indexing stopped for safety. Fix the symlinks or add an exclude.
(hint: run realpath on these links)
Activity
github-actions commentedon Jan 20, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
hbouhadji commentedon Jan 23, 2026
Same issue ! I thought my computer was going to explode, first time this has happened to me since apple m1.
here the tool calls he tries, had to kill them manually
Brian-Zavala commentedon Jan 23, 2026
@hbouhadji yeah my poor laptop sounded like a jet plane. I couldn't figure out why my pc was going so damn slow, I first thought it was neovim cause when I closed it, the pc sped up but in reality opencode was being the bully with its search processes. I finally just removed opencode altogether because I ran into more bugs like this.
ainslec commentedon Jan 24, 2026
Same thing is happening to me. I know what I did, but I don't know how to resolve this. Ideally I'd like OpenCode to detect this situation and calm things down.
How I did this is that I accidentally opened OpenCode in my home folder. Therefore it's indexing many many GB of data, including my Steam library. Would appreciate instructions how to clean this up, currently it's thrashing my swap file, and destroying my SSD in the process. Innocently of course, a bug, but a super dangerous bug. My computer locks up every few minutes and kills processes.
Brian-Zavala commentedon Jan 24, 2026
@ainslec you need to kill all opencode processes "killall -9 opencode"
emmaneugene commentedon Jan 25, 2026
Chiming in to say that I've experienced this issue too. I've been able to reproduce it fairly consistently like this:
opencodein my home directory (~)Globtool (rgunder the hood) search for some relevant patterns. The issue is that these processes occasionally run indefinitely and consume all available CPU resourcesI have a link to a thread where this issue occurred. And htere are the full commands of the 3
rgprocesses that were spawned:rg --files --glob=!.git/* --follow --hidden --glob=**/*opencode*rg --files --glob=!.git/* --follow --hidden --glob=**/opencode.jsonrg --files --glob=!.git/* --follow --hidden --glob=**/.opencode*Globworks when invoked in a more specific directory like~/.config, for example in this thread. So I guess this is fundamentally a performance issue with usingrgin a directory that has lots of symlinks, mounted volumes or system drives.I looked up the docs for tool configurations to see if there was any support for setting timeouts on tool calls (and sending a SIGTERM/SIGKILL for example), but so far found none. Not sure how feasible that would be to implement, but I feel it would be very useful
NikiLentz commentedon Jan 25, 2026
i have the same issue on my pop os 24.04, it didn't quite peg my cpu, but i was at 77% for minutes until i manually killed the ripgrep process, seems to me like rg or glob are the ones with an issue, is there a way to simply not allow it to use glob, even if it takes a few more tokens?
cau1k commentedon Jan 25, 2026
also seeing this on Arch and NixOS. I reduced the --max-filesize arg in
.config/ripgrep/configto 1M (default is 10M) and I'm not seeing as persistent CPU spikes. Not sure if this affects--glob.konovalov-nk commentedon Jan 31, 2026
This is exactly the problem why.
FULL STOP (see what I did here 🤣). What are we doing? Why do we need to follow symlinks for
Globtool?This can't be default behavior!
See this comment: BurntSushi/ripgrep#692 (comment)
Why are we overriding this with
--follow?Instead, what should actually happen, in this order:
Globdoesn't provide enough results, it's usually context problem. User didn't provide enough instructions or they're too vague.opencodecan't be this smart and try follow symlinks. This is not a fix for self-induced error. "No results" for agent means either "I'm searching for a wrong file" or "file truly doesn't exist". And you have failure mode that you can recover from very easily: "try another pattern" or "follow up to user explaining the problem"/), there should be a mechanism that either: blocks using--follow(why do you even need it if you can brute-force it withrg /), or uses sensible.rgignore/ripgreprcdefaults.and
Please, please don't make this even more cursed than that 🙏
Respect Linux defaults when using tools that interact with file system, they are for reasons.
rekram1-node commentedon Jan 31, 2026
I agree, let's fix it
I should've reviewed that pr better, apologies
jeroenev commentedon Feb 9, 2026
There should be an escape hatch tho, for allowing certain symlinks to be traversed.
When working with Odoo, many modules are loaded into a project (odoo, enterprise, OCA modules etc...) and when using worktrees, it doesn't make sense to keep dozens of copies of each folder per project.
Symlinking is an easy solution for this, but that no longer works if you disable it entirely without any option to allow RG to follow certain symlinks
NikiLentz commentedon Feb 9, 2026
it just doesn't have to follow them automatically for that, if it gets back a symlink it will simply make another call to the location of the relevant symlink. I'd bet that's less token intensive than autoresolving them.
jeroenev commentedon Feb 9, 2026
It seems to get stuck a lot on this for me.
It keeps searching with empty results, and then ends up using ls -la to traverse the files manually, wasting tons and tons of tokens and context, often still failing to find the right details.
I need it to be able to search and find results in symlinked folders, not just view a single symlinked file.
konovalov-nk commentedon Feb 9, 2026
@jeroenev This is already a "user-controlled" environment, for which I'd suggest writing/extending own
Blobtool. It can be an option to toggle this in native tool but 100% must not be default behavior. If there's some setup that requires traversing symlinks to find things outside of the main folder, this already too complicated to handle properly.Users should be empowered to write their own Glob patterns / folders, configurable or easily extensible. I suggest to try and write your own tool first. If this is a common use-case, it can be maintained.
jeroenev commentedon Feb 9, 2026
Doesn't seem like an uncommon use-case to me, at least for many "module-based" codebases I would think this is fairly common use-case.
I understand that it's no longer the default, especially when users run opencode from their home directory
I think it makes sense to at least make
--followopt-in, for users who know what they're symlinking in their project (which I would suspect is the majority of projects).konovalov-nk commentedon Feb 9, 2026
It can be supported as
followSymlinks: ["odoo", "enterprise", "oca", "path/to"], something like that. It must be configurable to explicitly allow following + there should be a mechanism that detects loops early and either stops until you fix it (UX-friendly) or simply ignores any symlinks deeper than 1 (not sure if possible).E.g.
rekram1-node commentedon Feb 11, 2026
Yeah we can make it opt in