-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recursive symlink significantly slows collection #624
Comments
I actually found a much more amusing result when attempting to reproduce this:
and then
I'm amused it stops after recusing 40 levels without erroring -- I suspect it hits EDIT: for best effect, I suggest making the terminal wider so you get a nice pyramid |
oh right, and of course this becomes a fun exponential problem if there's more than one symlink |
apparently attempting to discover |
There are two parts to the fix: * Don't visit directories which have already been visited. This fixes the exponential aspect of the bug. * Don't visit files which have already been visited. This fixes the more minor problem that, without this additional change, test_noop would be run twice, once as test_noop.py and once as symlink-0/test_noop.py. Fixes pytest-dev#624
This fixes trying to traverse exponentially many paths in the presence of symlink loops, and trying to run any tests discovered in that tree exponentially many times if collecting ever finishes. I wanted to also prevent visiting files more than once, but my first attempt broke --keep-duplicates. Fixes pytest-dev#624
had a similar issue, a recursive symlink was followed until it crashed... |
Although the pyramid that @asottile showed still happens in pytest |
closing this one as solved then |
Originally reported by: Brian Kearns (BitBucket: bdkearns, GitHub: bdkearns)
placing "ln -s . link" in a collected dir significantly slows down collection. it seems collection doesn't keep track of directories visited to prevent unnecessary recursion?
The text was updated successfully, but these errors were encountered: