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

Xdebug has detected a possible infinite loop (on Windows) #8400

Closed
arueckauer opened this issue Jan 12, 2024 · 8 comments
Closed

Xdebug has detected a possible infinite loop (on Windows) #8400

arueckauer opened this issue Jan 12, 2024 · 8 comments
Labels

Comments

@arueckauer
Copy link

Bug Report

Subject Details
Rector version 0.19.0

After upgrading a project to PHP 8.2 and rector/rector to 0.19.0, rector fails on a specific file with the following error:

[ERROR] Could not process ".\backend\Hygraph\Dealer\Mutation\UpsertFactory.php" file, due to:

"System error: "Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of
'256' frames"

Rector is invoked with

.\vendor\bin\rector process .\backend\Hygraph\Dealer\Mutation\UpsertFactory.php --debug --clear-cache

However, if --xdebug is used instead of --debug, the error is not thrown. The error is not reproducable on WSL.

See the full stack trace in the attachment (rector-error.txt).

Minimal PHP Code Causing Issue

Example works on demo. It contains the minimal code and configuration to reproduce it on Windows.

https://getrector.com/demo/18178975-aa7b-49c6-8c69-e1b5dd2490b9

Expected Behaviour

I'd expect Rector to successfully process the file.

 [OK] Rector is done!
@arueckauer arueckauer added the bug label Jan 12, 2024
@TomasVotruba
Copy link
Member

Thanks for sharing 🙏

Could you narrow down exact rule causing this?

@arueckauer
Copy link
Author

I'll do my best. Since I have never done this before, is there a good way to go about it or just go through rule by rule in the set?

@samsonasik
Copy link
Member

you can create github repo with github action running, and register windows-latest to os config, remove rules half by half from register until found the rule that cause it, so you can define $rectorConfig->rules()...

@TomasVotruba
Copy link
Member

@arueckauer Thank you 👍

I do cut rules by half, and taking the half that is breaking. Then repeat until it's breaking. In the end it's 99 % 2-3 rules combined.

I wrote in more detail here: https://tomasvotruba.com/blog/2021/02/01/effective-debug-tricks-narrow-scoping/

@arueckauer
Copy link
Author

Thank you both for the directions.

After creating a repo in a minimal configuration to recreate the issue, I noticed the issue is not triggered by a specific rule, but by any active rule.

While failing locally, the workflow run was successfully. The first difference in the environments I checked, was Xdebug. Locally was Xdebug v3.2.2 installed. With an update to Xdebug v3.3.1 the issue is resolved. Previously the project ran on PHP 8.1.24 with Xdebug v3.2.2 and rector showed no issues.

I am not sure, if there are possibly other issues caused by the same error. I let it up to you to decide how you would like to proceed. For me this solves the issue. Thanks!

@samsonasik
Copy link
Member

@arueckauer thank you, could you try upgrade xdebug locally to 3.3.1 and verify if that solve it, same like in CI?

@arueckauer
Copy link
Author

Yes, that is what it fixed locally, too. Sorry, if that was not clear from my previous comment.

@samsonasik
Copy link
Member

Thank you for verify, that seems the Xdebug bug, I am closing it then ;)

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

No branches or pull requests

3 participants