Skip to content

Fix infinite loop when collecting transitive excluded gems#3913

Merged
rafaelfranca merged 1 commit intomainfrom
rm-fix-loop
Jan 22, 2026
Merged

Fix infinite loop when collecting transitive excluded gems#3913
rafaelfranca merged 1 commit intomainfrom
rm-fix-loop

Conversation

@rafaelfranca
Copy link
Member

The code was modifying the excluded array while iterating over it with .each. In Ruby, .each continues to process newly added elements, which can cause excessive iterations or infinite loops when circular dependencies are present in the gem graph.

This caused 100% CPU usage in some environments.

Fixes #3912

@rafaelfranca rafaelfranca requested a review from a team as a code owner January 21, 2026 23:11
@rafaelfranca rafaelfranca added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jan 21, 2026
The code was modifying the `excluded` array while iterating over it
with `.each`. In Ruby, `.each` continues to process newly added
elements, which can cause excessive iterations or infinite loops when
circular dependencies are present in the gem graph.

This caused 100% CPU usage in some environments.

Fixes #3912
@rafaelfranca rafaelfranca merged commit befc088 into main Jan 22, 2026
53 of 54 checks passed
@rafaelfranca rafaelfranca deleted the rm-fix-loop branch January 22, 2026 18:34
@sequielo
Copy link

That was fast @rafaelfranca @vinistock 🚀

Thank you very much gentlemen, greetings from Argentina.

Will confirm it's working in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

100% CPU usage, circular dependency on indexer

3 participants