rector: [ERROR] Rector timeout after upgrading it to 0.19.0
Bug Report
| Subject | Details |
|---|---|
| Rector version | 0.19.0 |
Since the upgrade of rector (from 0.18.13 to 0.19.0) I have this big error :
I also try to folow these intructions without sucess https://getrector.com/documentation/troubleshooting-parallel
Minimal PHP Code Causing Issue
- Edit composer.json file
{
"require-dev": {
"rector/rector": "^0.19.0"
}
}
- Run
composer update
This is the 1st time Iโve had this at an rector update.
Expected Behaviour
Job passing like in version 0.18.13, just before upgrading rector to the 0.19.0
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 36 (19 by maintainers)
Commits related to this issue
- Update Composer dev tooling dependencies (#256) [](https://renovatebot.com) This PR contains the following updates: | Package | Change... — committed to Lendable/composer-license-checker by renovate[bot] 5 months ago
- Update Composer dev tooling dependencies (#643) [](https://renovatebot.com) This PR contains the following updates: | Package | Change... — committed to Lendable/aggregate by renovate[bot] 5 months ago
have same problem here with phpstan/phpstan (1.10.57) and rector/rector (0.19.5). Timeouts with parallel,Up to 4x slow without parallel
@TomasVotruba No, itโs perfect! Thank you so much for all you do for the PHP community ๐๐
@vinceAmstoutz See https://github.com/rectorphp/rector-src/pull/5477
Let me know if we can improve the feedback ๐
Thank you so much for your input. It help us to improve Rector further and fix the glitch to improve DX for other to come ๐
@vinceAmstoutz Thanks for more debug info. Indeed itโs not best practise to use
UP_TO_*sets inrector.phplonger than is their single-run. They run dozens of rules with very complex logic, as it take to get from Symfony 2 to 7. Itโs like running a Tesla control and checking all elements available since the first horse ride ๐See section 3: https://getrector.com/blog/5-common-mistakes-in-rector-config-and-how-to-avoid-them
I recommend to run those just once and remove those ๐
We got similar feedback from various project, seeing the Symfony โlevel up toโ approach is not the best, neither practical to use. Iโll think about how to deprecate those to avoid similar hustle for other users.
Thank you
Thank you, that seems on specific symfony rules, see changes on latest rector-symfony diffs
https://github.com/rectorphp/rector-symfony/commits/main/
if you found something fishy, feel free to provide a patch ๐
Thank you, at least it faster, I will merge the PR.
I will looking on other area that can improve performance.
Looking at the setlist you have, it seems you have huge of collection of setlist, could you narrow down and possibly found a rules that have bottleneck? Otherwise, we may need a reproducible repo.
@vinceAmstoutz thank you, thatโs seems strange, I create a PR to add
falsedefault autoload to disable autoload on class_alias at:for deprecating
Rector\Coresubnamespace.Could you try copy
src/core_namespace_aliases.phpthat usesfalsedefault autoload at:https://raw.githubusercontent.com/rectorphp/rector-src/add-false-autoload/src/core_namespace_aliases.php
to your
vendor/rector/rector/src/core_namespace_aliases.phpand verify if that increase the performance?@samsonasik So for now, Iโve got these benchmarks to share with you before testing @TomasVotruba suggestions
I also have screenshots of all the measurements I took if you need them.
Thank you, as short,
disableParallel()must be compared with samedisableParallel()config, andparallel()need to be compared withparallel()config.I am not sure if I have time to call on this, it is better to have reproducible repo ๐
@vinceAmstoutz Thanks for reaching out. We need to find out what commit caused this.
Could you give this approach a try and see which commit made the performance drop? https://github.com/rectorphp/rector/issues/8403#issuecomment-1893430494
On same
disableParallel(), that seems impossible you get 1 minutes as well, while 0.19.x you got 20 minutes.I guess 1 minutes in previous version 0.18.x, you are using parallel.
Comparing parallel vs disableParallel() is expected got many times slower.
I will ๐
I see. Weโll need to find out, which commit broke this for you, to avoid shooting in the dark.
Could you try few commits before 0.19.0 release and see, how it affects the speed? https://github.com/rectorphp/rector/commits/main/
FYI, i have 681 files and increased timeout by 60 seconds every time it died. Itโs working now with 360 seconds. Before, it took about 30 seconds. I looked the release yesterday but donโt find anything yet.
@vinceAmstoutz At first glance itโs suspicious that your process of 800 files times out so soon. To compare Rector codebase has 2100 files and it finishes in about 40 seconds as whole.
If you can provide costly combination of rules and paths, we could look at the performance. We use this approach to find the files and rules - https://tomasvotruba.com/blog/2021/02/01/effective-debug-tricks-narrow-scoping/
I apply some performance improvement on latest dev-main, could you try update to
"rector/rector": "dev-main"?If still happen, we may need a github repo to reproduce the issue, try use
$rectorConfig->disableParallel()to verify the issue on specific rule or in parallel process.