rector icon indicating copy to clipboard operation
rector copied to clipboard

Rector fails with: Child process timed out after 120 seconds

Open bicpi opened this issue 2 years ago • 5 comments

Bug Report

Hi!

Subject Details
0.13.9 Latest version when issue was observed

On a random basis my Rector runs end with the following error; also with increased memory; it deals with ~1100 classes.

$ ./vendor/bin/rector process --dry-run --memory-limit=1G
...
[ERROR] Could not process "/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php" file, due to:  "Child process timed out after 120 seconds". On line: 103              
  
[ERROR] Could not process some files, due to: "Reached system errors count limit of 50, exiting...". 

Especially when used in CI this lead to failed pipelines.

Minimal PHP Code Causing Issue

PHP Code is up-to-date, all Rector rules were applied and the runs mostly pass without the above error.

Expected Behaviour

It should always finish without error.

bicpi avatar Jul 28 '22 10:07 bicpi

is increasing timeout seconds help?

$rectorConfig->parallel(240);

or is disable parallel make it working?

$rectorConfig->disableParallel();

samsonasik avatar Jul 28 '22 12:07 samsonasik

I am experiencing the same. I will try the suggestions.

rafaelbernard avatar Jul 28 '22 16:07 rafaelbernard

Fixed on my end. Increasing the timeout and adjusting the max number of processes to be aligned with the machine running it:

$rectorConfig->parallel(240, 2);

rafaelbernard avatar Jul 28 '22 19:07 rafaelbernard

@rafaelbernard awesome! That's will be worth mentioning it in the documentation, could you try create PR for documenting how to troubleshoot it? You can create PR to

https://github.com/rectorphp/rector-src/tree/main/build/target-repository/docs

Thank you.

samsonasik avatar Jul 29 '22 02:07 samsonasik

Thanks everyone for the feedback. For me it was pretty stable for a while now but now randomly hit again; so sooner or later I'll try the suggestions, thank you!

bicpi avatar Jul 29 '22 12:07 bicpi

[ERROR] Could not process "/app/vendor/rector/rector/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php" file, due to: "Child process timed out after 120 seconds". On line: 103

Looking at the error, it looks like you're running on the root directory. That should never happen. Always explicitly state your directories with PHP code, e.g.

vendor/bin/rector process src

If this error repeat, please create a reproducible repository on Github, so we have isolated environment and can tackle this issue directly :slightly_smiling_face:

Thanks

TomasVotruba avatar Aug 17 '22 14:08 TomasVotruba

Hi Thomas, Sorry, the example code was incomplete; we are indeed limiting the runs on certain directories and the error occurred from time to time, either locally on a strong machine or during CI with less stronger workers. For now we excluded it from our CI and run the checks from time to time manually and limited scope.

bicpi avatar Aug 29 '22 10:08 bicpi