-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Segmentation fault when generating composer autoload with 50k+ classes #11795
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
Comments
I guess @nielsdos beat me to it 🙂 But I can reproduce this:
This can also be reproduced with |
Race ya ;) /jk I got the same cycle error, but that might be a red herring though because it assumes that > 10000 uses means a cycle:
there are more than that nr of uses here. |
I raised the 10000 and the cycle error is gone.
repeat that a couple of hundred times... It's because the SCC algorithm is recursive instead of iterative. I can resume work on that PR probably, or someone else can too if they want (I'm kinda deep down in ext/dom troubles). There's links in the comment section to relevant papers & implementations. I believe the implementation I wrote can be adapted fairly easily to those reference algorithms since they have the same core idea: going up and down the DFS with a flag basically. |
@nielsdos your approach to SCC algorithm conversion might be right, but I wouldn't harry to fix it. The application of the original algorithm might be not efficient in the first place. |
Might be not completely fixed, see #12953 |
Description
Hey.
Running
composer dumpautoload --optimize-autoloader
twice on a large codebase (50k+ classes it seems) with OPCache enabled in Docker results in a segmentation fault. Changing OPCache settings doesn't seem to do anything.This is reproducible on a x86_64, but is not reproducible on ARM MacBook. PHP 8.1.9 is also affected.
I've prepared a small repository with reproduction: https://github.com/oprypkhantc/php-composer-segfault/tree/main
The first
dump -o
results in an exit code0
and this output:The second
dump -o
results in an exit code139
and this output (notice missing line compared to the first run):PHP Version
8.2.8
Operating System
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: