Skip to content
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

Rector appears to be caching files before they've finished processing. #7770

Closed
aboyton opened this issue Feb 12, 2023 · 11 comments · Fixed by rectorphp/rector-src#3604 or rectorphp/rector-src#3614
Labels

Comments

@aboyton
Copy link

aboyton commented Feb 12, 2023

Bug Report

Subject Details
Rector version 0.15.13

When running Rector for some reason I have a file that is failing to process, with an error very similar to #7586. If there are files which work they pass and then Rector hangs when it gets to the problematic file. If I just try process the problematic file then I get no output whatsoever.

This issue though isn't about that bug, this issue is about incorrect caching of files when Rector hangs.

When Rector does hang, if I quit rector with Ctrl + C and then run again it appears as those the file that was problematic has been marked as processed and so running Rector succeeds the second time.

If I run with vendor/bin/rector process --clear-cache then I get stuck on the problematic file again, or if I change the list of files to process (which appears to reset the cache) it fails the first run and succeeds the second.

Minimal PHP Code Causing Issue

Unfortunately I don't have that as the code that is breaking things appears to work on https://getrector.org/demo/ :(

I've set $rectorConfig->parallel(seconds: 600, maxNumberOfProcess: 1); to make things easier to debug, but the issue occurs with parallel processes as well.

Expected Behaviour

When a file is processed it should only be added to the cache when it has successfully finished processing.

@yguedidi
Copy link

yguedidi commented Apr 11, 2023

@aboyton maybe you would like to test latest master main of rector now that rectorphp/rector-src#3604 is merge?
It should fixes the caching issue

@samsonasik
Copy link
Member

There is no master branch, you probably mean main as dev-main in composer

@yguedidi
Copy link

Thanks @samsonasik I thought about that when I thought about writing this comment, but when actually writing... 😓

@samsonasik
Copy link
Member

Re-open, @yguedidi I need to revert your change as I found double --dry-run no longer working after PR:

Screen Shot 2023-04-11 at 15 17 59

@samsonasik samsonasik reopened this Apr 11, 2023
@samsonasik
Copy link
Member

Reverting it at rectorphp/rector-src#3607

@yguedidi
Copy link

yguedidi commented Apr 11, 2023

@samsonasik thank you for catching this! looks like all my contributions introduce regressions... 😅
Will work on a fix when I have time, I have an idea why the issue

@yguedidi
Copy link

yguedidi commented May 1, 2023

@aboyton in next release you'll be able to enjoy a reliable cache! 🎉

@aboyton
Copy link
Author

aboyton commented May 1, 2023

Thanks. That's awesome. I'll have to try it out once the next release is released.

Any idea why rector --clear-cache can take 10+ minutes to run? Hopefully I won't need this going forth but the slowness is frustrating.

@yguedidi
Copy link

yguedidi commented May 1, 2023

Any idea why rector --clear-cache can take 10+ minutes to run? Hopefully I won't need this going forth but the slowness is frustrating.

10+ minutes on which project?

@aboyton
Copy link
Author

aboyton commented May 1, 2023

Any idea why rector --clear-cache can take 10+ minutes to run? Hopefully I won't need this going forth but the slowness is frustrating.

10+ minutes on which project?

Internal work repository of 1M+ lines of code.

@yguedidi
Copy link

yguedidi commented May 2, 2023

@aboyton depending on your project and enabled rectors, but I'd say that 10minutes for such a big project looks OK when running without cache :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants