Skip to content

Performance regression when using rector 1.05 with phpstan 1.11.0 #8638

@dorrogeray

Description

@dorrogeray

Bug Report

Looks like that there is some kind of performance issue, perhaps a memory leak. It manifests itself when I use a large number of processes, like 30. There also seems to be increased memory usage & the initial start of the workers seems delayed (progress bar is stuck at 0 for long time).

Sometimes, I even get this:
image

Subject Details
Rector version v1.0.5
www-data@4486ce23c81e:~/html$ vendor/bin/rector process
  3170/12825 [▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░]  24%[14-May-2024 15:47:27 EUROPE/LONDON] PHP Fatal error:  Uncaught Error: Call to a member function end() on null in /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php:120
Stack trace:
#0 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(49): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ParallelProcess->quit()
#1 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(59): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ProcessPool->quitProcess()
#2 /var/www/html/vendor/rector/rector/src/Parallel/Application/ParallelFileProcessor.php(108): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ProcessPool->quitAll()
#3 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php(108): Rector\Parallel\Application\ParallelFileProcessor->Rector\Parallel\Application\{closure}()
#4 /var/www/html/vendor/rector/rector/vendor/react/event-loop/src/Timer/Timers.php(86): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ParallelProcess->RectorPrefix202405\Symplify\EasyParallel\ValueObject\{closure}()
#5 /var/www/html/vendor/rector/rector/vendor/react/event-loop/src/StreamSelectLoop.php(150): RectorPrefix202405\React\EventLoop\Timer\Timers->tick()
#6 /var/www/html/vendor/rector/rector/src/Parallel/Application/ParallelFileProcessor.php(178): RectorPrefix202405\React\EventLoop\StreamSelectLoop->run()
#7 /var/www/html/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(237): Rector\Parallel\Application\ParallelFileProcessor->process()
#8 /var/www/html/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(136): Rector\Application\ApplicationFileProcessor->runParallel()
#9 /var/www/html/vendor/rector/rector/src/Console/Command/ProcessCommand.php(117): Rector\Application\ApplicationFileProcessor->run()
#10 /var/www/html/vendor/rector/rector/vendor/symfony/console/Command/Command.php(327): Rector\Console\Command\ProcessCommand->execute()
#11 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(960): RectorPrefix202405\Symfony\Component\Console\Command\Command->run()
#12 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(333): RectorPrefix202405\Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/html/vendor/rector/rector/src/Console/ConsoleApplication.php(53): RectorPrefix202405\Symfony\Component\Console\Application->doRun()
#14 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(216): Rector\Console\ConsoleApplication->doRun()
#15 /var/www/html/vendor/rector/rector/bin/rector.php(130): RectorPrefix202405\Symfony\Component\Console\Application->run()
#16 /var/www/html/vendor/rector/rector/bin/rector(5): require_once('...')
#17 /var/www/html/vendor/bin/rector(119): include('...')
#18 {main}
  thrown in /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php on line 120
Fatal error: Uncaught Error: Call to a member function end() on null in /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php:120
Stack trace:
#0 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(49): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ParallelProcess->quit()
#1 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php(59): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ProcessPool->quitProcess()
#2 /var/www/html/vendor/rector/rector/src/Parallel/Application/ParallelFileProcessor.php(108): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ProcessPool->quitAll()
#3 /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php(108): Rector\Parallel\Application\ParallelFileProcessor->Rector\Parallel\Application\{closure}()
#4 /var/www/html/vendor/rector/rector/vendor/react/event-loop/src/Timer/Timers.php(86): RectorPrefix202405\Symplify\EasyParallel\ValueObject\ParallelProcess->RectorPrefix202405\Symplify\EasyParallel\ValueObject\{closure}()
#5 /var/www/html/vendor/rector/rector/vendor/react/event-loop/src/StreamSelectLoop.php(150): RectorPrefix202405\React\EventLoop\Timer\Timers->tick()
#6 /var/www/html/vendor/rector/rector/src/Parallel/Application/ParallelFileProcessor.php(178): RectorPrefix202405\React\EventLoop\StreamSelectLoop->run()
#7 /var/www/html/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(237): Rector\Parallel\Application\ParallelFileProcessor->process()
#8 /var/www/html/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(136): Rector\Application\ApplicationFileProcessor->runParallel()
#9 /var/www/html/vendor/rector/rector/src/Console/Command/ProcessCommand.php(117): Rector\Application\ApplicationFileProcessor->run()
#10 /var/www/html/vendor/rector/rector/vendor/symfony/console/Command/Command.php(327): Rector\Console\Command\ProcessCommand->execute()
#11 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(960): RectorPrefix202405\Symfony\Component\Console\Command\Command->run()
#12 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(333): RectorPrefix202405\Symfony\Component\Console\Application->doRunCommand()
#13 /var/www/html/vendor/rector/rector/src/Console/ConsoleApplication.php(53): RectorPrefix202405\Symfony\Component\Console\Application->doRun()
#14 /var/www/html/vendor/rector/rector/vendor/symfony/console/Application.php(216): Rector\Console\ConsoleApplication->doRun()
#15 /var/www/html/vendor/rector/rector/bin/rector.php(130): RectorPrefix202405\Symfony\Component\Console\Application->run()
#16 /var/www/html/vendor/rector/rector/bin/rector(5): require_once('...')
#17 /var/www/html/vendor/bin/rector(119): include('...')
#18 {main}
  thrown in /var/www/html/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php on line 120

Minimal PHP Code Causing Issue

Not related to particular code

Expected Behaviour

Rector works fine when used in parallel mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions