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

Infinite loop in avoid_redundant_argument_values with cyclic redirecting constructors #4970

Closed
DanTup opened this issue May 14, 2024 · 3 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DanTup
Copy link
Contributor

DanTup commented May 14, 2024

This was originally reported by @gaaclarke at Dart-Code/Dart-Code#5101. Opening the Flutter engine code would cause the analysis server to sit using 100% CPU indefinitely. It turns out to be caused by the nested Dart SDK, and indeed you can reproduce the issue opening this whole repository here.

It seems to get stuck in a loop in this code:

https://github.com/dart-lang/sdk/blob/f774ec53e7b107664baf65a50395a717c3de26a2/pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart#L138-L140

Because the constructors redirect to each other:

image

The source of the file that's being analyzed is here:

https://github.com/dart-lang/sdk/blob/f774ec53e7b107664baf65a50395a717c3de26a2/tests/language/factory/redirection3_cyclic_test.dart#L7-L16

@pq
Copy link
Member

pq commented May 14, 2024

FYI @srawlins

@srawlins srawlins added P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 14, 2024
@pq pq transferred this issue from dart-lang/sdk May 14, 2024
@srawlins
Copy link
Member

We don't get many P1 linter bugs, but I think this one qualifies! Great find, @gaaclarke and @DanTup !

@srawlins srawlins self-assigned this May 14, 2024
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue May 14, 2024
Fixes dart-lang/linter#4970

Change-Id: I75e6fd554f12038acbd7604f52b2fe50d11a682d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366500
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
@srawlins
Copy link
Member

Fixed with dart-lang/sdk@7c5437b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants