lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

Fix stack overflow for large projects #1484

Open Skipants opened 1 year ago

Skipants commented 1 year ago

Description

When large projects have a lot of missing objects in the first pass of parsing Ruby files we would run into stack overflows. This happens because, when there was a missing object in a parsed Ruby file, we would recursively call #parse_remaining_files. When this happens a lot the stack would get huge.

We fix this by instead keeping a list of files that we want to retry and re-parse them in another pass. When we can no longer resolve any more files we break the loop.

Fixes https://github.com/lsegal/yard/issues/1375

Completed Tasks

It's difficult to write a test for this because it depended on a lot of files until it would break.

I tested this by running yard doc on my company's internal monolith and having it working, whereas the current release of yard would SystemStackError