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

<foo< breaks the analyser with big memory hog #34850

Open
peekpt opened this issue Oct 18, 2018 · 9 comments
Open

<foo< breaks the analyser with big memory hog #34850

peekpt opened this issue Oct 18, 2018 · 9 comments
Labels
analyzer-stability area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@peekpt
Copy link

peekpt commented Oct 18, 2018

I came from flutter but I think it's dart related.
Procedure:
create new dart file and type
<foo<
try to write something above that line.

Analyser hangs and stops responding

Dart VM version: 2.1.0-edge.5dfe3c8f94c9e880ad56d41316c0830817c96128 (Wed Oct 17 22:26:47 2018 +0000) on "macos_x64"

Affects VScode and Android Studio.

Needs urgent attention because affects code like

Future<List<int>> ...

@scheglov
Copy link
Contributor

This code:

foo
Future<List<int>> bar() {}

produces inconsistent Token stream.

It is parsed as foo Future<List>() {} bar() {}, and the first pair () is synthetic.
image

However when we look on tokens after Future, it does not point at this () pair, it points at a single token >>, that points at bar.
image

The result of this is that when Analyzer tries to compute the API signature, it cannot find the end token (the closing parenthesis in the first () pair) and cycles.

@scheglov scheglov added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P0 A serious issue requiring immediate resolution labels Oct 18, 2018
@scheglov
Copy link
Contributor

@danrubel @bwilkerson please let me know if this is an expected scanner / parser behavior and is something I need to protect against in Analyzer.

@peekpt
Copy link
Author

peekpt commented Oct 18, 2018

@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/80680

@bwilkerson bwilkerson added P1 A high priority bug; for example, a single project is unusable or has many test failures and removed P0 A serious issue requiring immediate resolution labels Oct 18, 2018
@bwilkerson
Copy link
Member

While that CL fixed the hang, it doesn't fix the parser issue, so I'd like to leave this open to track that work.

@iampawan
Copy link

This issue still exists when running multiple projects together.

@bwilkerson
Copy link
Member

I have no idea why the bot closed this issue.

@danrubel Feel free to close this issue if appropriate.

@bwilkerson bwilkerson reopened this May 29, 2019
@danrubel danrubel removed their assignment Dec 12, 2019
@jing-pei
Copy link

same issues

@stereotype441
Copy link
Member

Using a recent version of the analyzer (as of cb17fb6f7b24feeeac54421473d84d9149c2da90), I'm not able to reproduce the hang. #34850 (comment) indicates that the hang has been fixed, but we have an underlying parser issue still. Since the user manifestation of the bug is taken care of, I'm re-classifying as P2.

@stereotype441 stereotype441 added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jan 30, 2020
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Nov 16, 2021
@srawlins srawlins added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-stability area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants