rector: [Parallel]: Child process timed out after 60 seconds

Bug Report

Subject Details
Rector version a66be5920506820182d0208d20f02e5e8a4096d7

Parallel mode maximizes the use of computer resources and ends with the message below. This happens when I scan large amounts of files. And only in parallel mode.

dev@4a065bbde783:$ vendor/bin/rector -n --clear-cache --no-diffs
   40/3358 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   1%
                                                                                                                        
 [ERROR] Could not process                                                                                              
         "/web/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php"    
         file, due to:                                                                                                  
         "Child process timed out after 60 seconds". On line: 100                                                       
                                                                                                                        

                                                                                                                        
 [ERROR] Could not process some files, due to:                                                                          
         "Reached system errors count limit of 20, exiting...".                       

Minimal PHP Code Causing Issue

Cannot reproduce the issue using https://getrector.org/demo/

<?php declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $parameters = $containerConfigurator->parameters();
    $parameters->set(Option::PARALLEL, true);
    $parameters->set(Option::PATHS, [
        __DIR__ . '/app',
        __DIR__ . '/bootstrap',
        __DIR__ . '/config',
        __DIR__ . '/public',
        __DIR__ . '/database',
        __DIR__ . '/resources/lang',
        __DIR__ . '/resources/views',
        __DIR__ . '/routes',
        __DIR__ . '/tests',
    ]);
};

Expected Behaviour

[OK] 2 files would have changed (dry-run) by Rector  

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted comments

Closing as duplicate of https://github.com/rectorphp/rector/issues/6914

If it still remains after that issue is solved, we can re-open.

Yes, yes, I found WorkerRunner. Equivalent to the above solution:

\Rector\Parallel\WorkerRunner::run:

$this->currentFileProvider->setFile($file);
if (!$this->phpFileProcessor->supports($file, $configuration)) {
    continue;
}
$currentErrorsAndFileDiffs = $this->phpFileProcessor->process($file, $configuration);

After changing to 120, I get this message:

 [ERROR] Could not process some files, due to:                                                                          
         "Child process error: Killed                                                                                   
         ".