-
-
Notifications
You must be signed in to change notification settings - Fork 703
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
[ERROR] Rector timeout after upgrading it to 0.19.0 #8403
[ERROR] Rector timeout after upgrading it to 0.19.0 #8403
Comments
Rector 0.19.0 parallel config is default to $rectorConfig->parallel(120, 16, 15); |
Thanks for reporting 👍 What is the output when you disable parallel? See #8396 (comment) as well, there might be costly loops that were not visible before. |
I apply some performance improvement on latest dev-main, could you try update to If still happen, we may need a github repo to reproduce the issue, try use |
I've updated the timeout to 120 and released 0.19.1 👍 |
@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/ |
FYI, i have 681 files and increased timeout by 60 seconds every time it died. |
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? {
"require": {
"rector/rector": "dev-main#dbbdf42842490a97fd9c35e4e899192e1b06f10b"
}
} composer update |
I will 👍 |
@TomasVotruba When I disable parallel I have this after almost 20 minutes (before this release it was 30s or 1min maximum) But with And with the default value & the I will try soon on |
On same I guess 1 minutes in previous version 0.18.x, you are using parallel. Comparing parallel vs disableParallel() is expected got many times slower. |
@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? |
It also possibly issue on phpstan itself, start from 1.10.55, The |
To exactly compare, the both compares need exists: 1 Disable Parallel
2. Enable Parallel
We also needs a reproducible repo, that we can found a possible bottleneck, as it can from Rector or phpstan itself. |
No, before these tests, my configuration was as follows <?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);
$rectorConfig->importNames();
$rectorConfig->sets([
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::STRICT_BOOLEANS,
SetList::TYPE_DECLARATION,
SetList::PHP_83,
LevelSetList::UP_TO_PHP_83,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonyLevelSetList::UP_TO_SYMFONY_63,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]);
}; |
Yes @TomasVotruba I will soon as possible |
Line 15 in 0d611d8
so 1 minutes is expected. |
@samsonasik I'll try what @TomasVotruba suggests here #8403 (comment) and if that's not enough, I'll try to make an accessible repo because it's a proprietary project. |
@samsonasik But there's no doubt that I was in |
sure, but 20 times slower is impossible with same |
Maybe, but whatever I try, it's much slower and doesn't work... 😕 |
I used it a very big projects, scan 4000+ files, with many files has 3000/4000+ lines, that's not that slow, and only take so without reproducible repo, we probably can't help further. you're comparing |
As I have already say, I will testing all possibilities soon as you describe here after testing what @TomasVotruba says. If we need more I will do my best to reproduce that for you. If not, we could make a call so that you can test live? |
Thank you, as short, I am not sure if I have time to call on this, it is better to have reproducible repo :) |
@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. |
@vinceAmstoutz thank you, that's seems strange, I create a PR to add for deprecating Could you try copy https://raw.githubusercontent.com/rectorphp/rector-src/add-false-autoload/src/core_namespace_aliases.php to your |
@samsonasik I've test on |
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. |
@samsonasik After many combination tests, it works with my rector configuration if I don't use these rules: <?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);
$rectorConfig->importNames();
$rectorConfig->sets([
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::STRICT_BOOLEANS,
SetList::TYPE_DECLARATION,
SetList::PHP_83,
LevelSetList::UP_TO_PHP_83,
// SymfonySetList::SYMFONY_CODE_QUALITY,
// SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
// SymfonyLevelSetList::UP_TO_SYMFONY_64,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]);
}; |
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 ;) |
@vinceAmstoutz Thanks for more debug info. See section 3: 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 |
@vinceAmstoutz See rectorphp/rector-src#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 🙏 |
@TomasVotruba Thank you for your time and explanations. I learned a lot about the best practice of the rector, I will read your book very soon to go further. At the moment, it doesn't work with this (without $rectorConfig->sets([
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::STRICT_BOOLEANS,
SetList::TYPE_DECLARATION,
SetList::PHP_83,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_64,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]); But if I comment Have you a solution? |
@TomasVotruba No, it's perfect! Thank you so much for all you do for the PHP community 🙏🐘 |
@TomasVotruba @samsonasik I've found a solution that's not so great, adding this |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | `^3.47.1` -> `^3.48.0` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.47.1/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.47.1/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpunit/phpunit](https://phpunit.de/) ([source](https://togithub.com/sebastianbergmann/phpunit)) | `^10.5.8` -> `^10.5.9` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpunit%2fphpunit/10.5.8/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpunit%2fphpunit/10.5.8/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [rector/rector](https://getrector.org) ([source](https://togithub.com/rectorphp/rector)) | `^0.19.1` -> `^0.19.2` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/rector%2frector/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/rector%2frector/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/rector%2frector/0.19.1/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/rector%2frector/0.19.1/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.48.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.1...v3.48.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.1...v3.48.0) </details> <details> <summary>sebastianbergmann/phpunit (phpunit/phpunit)</summary> ### [`v10.5.9`](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) </details> <details> <summary>rectorphp/rector (rector/rector)</summary> ### [`v0.19.2`](https://togithub.com/rectorphp/rector/releases/tag/0.19.2): Released Rector 0.19.2 [Compare Source](https://togithub.com/rectorphp/rector/compare/0.19.1...0.19.2) #### New features and Changes 🎉 - \[DX] Depreate heavy and conflicting Symfony/Twig/PHPUnit level sets ([#​5477](https://togithub.com/rectorphp/rector-src/pull/5477)) - Remove collectors, as performance very costly and not practically useful ([#​5470](https://togithub.com/rectorphp/rector-src/pull/5470)) <br> #### Bugfixes 🐛 - **Fix repeated timeouts on CI - [https://github.com/rectorphp/rector/issues/8403](https://togithub.com/rectorphp/rector/issues/8403), [https://github.com/rectorphp/rector/issues/8396](https://togithub.com/rectorphp/rector/issues/8396)** - Bump PHPStan to 1.10.56 ([#​5471](https://togithub.com/rectorphp/rector-src/pull/5471)) - Remove collector interface and fix SpatieEnumClassToEnumRector already has underscore to double underscore ([#​5473](https://togithub.com/rectorphp/rector-src/pull/5473)) - \[DX] Depreate heavy and conflicting Symfony/Twig/PHPUnit level sets ([#​5477](https://togithub.com/rectorphp/rector-src/pull/5477)) <br> #### Removed 💀 - \[Performance] Remove unused AttributeKey::ARGUMENT_POSITION ([#​5469](https://togithub.com/rectorphp/rector-src/pull/5469)) - \[Autoload] Remove src/core_namespace_aliases.php ([#​5476](https://togithub.com/rectorphp/rector-src/pull/5476)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Lendable/composer-license-checker). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ben Challis <[email protected]>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [php-cs-fixer/shim](https://togithub.com/PHP-CS-Fixer/shim) | `^3.47.1` -> `^3.48.0` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/php-cs-fixer%2fshim/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/php-cs-fixer%2fshim/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/php-cs-fixer%2fshim/3.47.1/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/php-cs-fixer%2fshim/3.47.1/3.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [phpunit/phpunit](https://phpunit.de/) ([source](https://togithub.com/sebastianbergmann/phpunit)) | `^10.5.7` -> `^10.5.9` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/phpunit%2fphpunit/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/phpunit%2fphpunit/10.5.7/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/phpunit%2fphpunit/10.5.7/10.5.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [rector/rector](https://getrector.org) ([source](https://togithub.com/rectorphp/rector)) | `^0.19.1` -> `^0.19.2` | [![age](https://developer.mend.io/api/mc/badges/age/packagist/rector%2frector/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/rector%2frector/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/rector%2frector/0.19.1/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/rector%2frector/0.19.1/0.19.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/shim (php-cs-fixer/shim)</summary> ### [`v3.48.0`](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.1...v3.48.0) [Compare Source](https://togithub.com/PHP-CS-Fixer/shim/compare/v3.47.1...v3.48.0) </details> <details> <summary>sebastianbergmann/phpunit (phpunit/phpunit)</summary> ### [`v10.5.9`](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9) ### [`v10.5.8`](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.7...10.5.8) [Compare Source](https://togithub.com/sebastianbergmann/phpunit/compare/10.5.7...10.5.8) </details> <details> <summary>rectorphp/rector (rector/rector)</summary> ### [`v0.19.2`](https://togithub.com/rectorphp/rector/releases/tag/0.19.2): Released Rector 0.19.2 [Compare Source](https://togithub.com/rectorphp/rector/compare/0.19.1...0.19.2) #### New features and Changes 🎉 - \[DX] Depreate heavy and conflicting Symfony/Twig/PHPUnit level sets ([#​5477](https://togithub.com/rectorphp/rector-src/pull/5477)) - Remove collectors, as performance very costly and not practically useful ([#​5470](https://togithub.com/rectorphp/rector-src/pull/5470)) <br> #### Bugfixes 🐛 - **Fix repeated timeouts on CI - [https://github.com/rectorphp/rector/issues/8403](https://togithub.com/rectorphp/rector/issues/8403), [https://github.com/rectorphp/rector/issues/8396](https://togithub.com/rectorphp/rector/issues/8396)** - Bump PHPStan to 1.10.56 ([#​5471](https://togithub.com/rectorphp/rector-src/pull/5471)) - Remove collector interface and fix SpatieEnumClassToEnumRector already has underscore to double underscore ([#​5473](https://togithub.com/rectorphp/rector-src/pull/5473)) - \[DX] Depreate heavy and conflicting Symfony/Twig/PHPUnit level sets ([#​5477](https://togithub.com/rectorphp/rector-src/pull/5477)) <br> #### Removed 💀 - \[Performance] Remove unused AttributeKey::ARGUMENT_POSITION ([#​5469](https://togithub.com/rectorphp/rector-src/pull/5469)) - \[Autoload] Remove src/core_namespace_aliases.php ([#​5476](https://togithub.com/rectorphp/rector-src/pull/5476)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Lendable/aggregate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Marcin Michalski <[email protected]>
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 |
Bug Report
Since the upgrade of rector (from 0.18.13 to 0.19.0) I have this big error :
![image](https://private-user-images.githubusercontent.com/46444652/296797733-9699792e-89d2-4be5-b66f-2d2e62e16d81.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMzc4NjQsIm5iZiI6MTczOTEzNzU2NCwicGF0aCI6Ii80NjQ0NDY1Mi8yOTY3OTc3MzMtOTY5OTc5MmUtODlkMi00YmU1LWI2NmYtMmQyZTYyZTE2ZDgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDIxNDYwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIxOWJhOGRhMDNmNzIxZGZlZjEzNTc2NDVhYzkxYTczNzcwNTUyNDNiZmMxMDdhNDAyYjdlZGFmMjE3MTM0OTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.4LBqdHk_ePqoaL9EMSqfuds9WgAVMVtx-2qaASDV5dU)
I also try to folow these intructions without sucess
https://getrector.com/documentation/troubleshooting-parallel
Minimal PHP Code Causing Issue
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 the0.19.0
The text was updated successfully, but these errors were encountered: