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

Searching for usages of NavigationTreeNode.editCount never terminates #44196

Closed
stereotype441 opened this issue Nov 13, 2020 · 5 comments
Closed
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@stereotype441
Copy link
Member

  • Check out latest code as of 02b2e53
  • Using IntelliJ, set up a project with the following analysis roots:
    • pkg/_fe_analyzer_shared
    • pkg/analysis_server
    • pkg/analysis_server_client
    • pkg/analyzer
    • pkg/analyzer_cli
    • pkg/analyzer_plugin
    • pkg/dartdev
    • pkg/front_end
    • pkg/kernel
    • pkg/nnbd_migration
  • Place the cursor on the declaration of NavigationTreeNode.editCount
  • Find usages.

Expected result: usages are found within a few seconds.
Observed result: the dialog box "Searching for usages in project files" never goes away. Judging by the output of top, the analysis server stops searching after a few seconds.

@stereotype441
Copy link
Member Author

@scheglov FYI

@keertip keertip added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Nov 13, 2020
@devoncarew
Copy link
Member

We've seen some reports of this internally as well; having a repro for this problem is definitely helpful.

@scheglov
Copy link
Contributor

It looks that IntelliJ client throws an exception, may be an invalid JSON answer from DAS, or a bug in the clients / JSON parser.

1605287331461 => {"id":"31836","method":"search.findElementReferences","params":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":926,"includePotential":true},"clientRequestTime":1605287331460}
1605287331461 <= {"id":"31836","result":{"id":"20","element":{"kind":"FIELD","name":"editCount","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":926,"length":9,"startLine":28,"startColumn":13},"flags":4,"returnType":"int"}}}
1605287331550 <= {"event":"search.results","params":{"id":"20","results":[{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/navigation_tree_renderer.dart","offset":2422,"length":9,"startLine":62,"startColumn":11},"kind":"REFERENCE","isPotential":false,"path":[{"kind":"METHOD","name":"_renderNavigationSubtree","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/navigation_tree_renderer.dart","offset":1752,"length":24,"startLine":45,"startColumn":28},"flags":16,"parameters":"(List<UnitLink> links, int depth)","returnType":"List<NavigationTreeNode>"},{"kind":"CLASS","name":"NavigationTreeRenderer","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/navigation_tree_renderer.dart","offset":926,"length":22,"startLine":24,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree_renderer.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/navigation_tree_renderer.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/navigation_tree_renderer.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1178,"length":9,"startLine":35,"startColumn":9},"kind":"WRITE","isPotential":false,"path":[{"kind":"CONSTRUCTOR","name":"directory","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1022,"length":9,"startLine":31,"startColumn":22},"flags":0,"parameters":"({@required String name, @required List<NavigationTreeNode> subtree})","returnType":"NavigationTreeNode"},{"kind":"CLASS","name":"NavigationTreeNode","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":326,"length":18,"startLine":8,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1385,"length":9,"startLine":42,"startColumn":22},"kind":"WRITE","isPotential":false,"path":[{"kind":"PARAMETER","name":"editCount","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1385,"length":9,"startLine":42,"startColumn":22},"flags":0,"returnType":"int"},{"kind":"CONSTRUCTOR","name":"file","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1276,"length":4,"startLine":38,"startColumn":22},"flags":0,"parameters":"({@required String name, @required String path, @required String href, @required int editCount})","returnType":"NavigationTreeNode"},{"kind":"CLASS","name":"NavigationTreeNode","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":326,"length":18,"startLine":8,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1742,"length":9,"startLine":52,"startColumn":9},"kind":"WRITE","isPotential":false,"path":[{"kind":"CONSTRUCTOR","name":"fromJson","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1487,"length":8,"startLine":46,"startColumn":22},"flags":0,"parameters":"(dynamic json)","returnType":"NavigationTreeNode"},{"kind":"CLASS","name":"NavigationTreeNode","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":326,"length":18,"startLine":8,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart","offset":6918,"length":9,"startLine":195,"startColumn":29},"kind":"READ","isPotential":false,"path":[{"kind":"METHOD","name":"havingEditCount","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart","offset":6854,"length":15,"startLine":194,"startColumn":35},"flags":0,"parameters":"(dynamic matcher)","returnType":"TypeMatcher<NavigationTreeNode>"},{"kind":"EXTENSION","name":null,"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart","offset":-1,"length":0,"startLine":1,"startColumn":0},"flags":16},{"kind":"COMPILATION_UNIT","name":"navigation_tree_renderer_test.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/test/front_end/navigation_tree_renderer_test.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/migration.dart","offset":24453,"length":9,"startLine":722,"startColumn":30},"kind":"READ","isPotential":false,"path":[{"kind":"FUNCTION","name":"writeNavigationSubtree","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/migration.dart","offset":23249,"length":22,"startLine":694,"startColumn":6},"flags":8,"parameters":"(Element parentElement, List<NavigationTreeNode> tree)","returnType":"void"},{"kind":"COMPILATION_UNIT","name":"migration.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/migration.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/migration.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":2027,"length":9,"startLine":60,"startColumn":13},"kind":"READ","isPotential":false,"path":[{"kind":"METHOD","name":"toJson","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1803,"length":6,"startLine":54,"startColumn":23},"flags":0,"parameters":"()","returnType":"Map<String, Object>"},{"kind":"CLASS","name":"NavigationTreeNode","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":326,"length":18,"startLine":8,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]},{"location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":2059,"length":9,"startLine":60,"startColumn":45},"kind":"READ","isPotential":false,"path":[{"kind":"METHOD","name":"toJson","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":1803,"length":6,"startLine":54,"startColumn":23},"flags":0,"parameters":"()","returnType":"Map<String, Object>"},{"kind":"CLASS","name":"NavigationTreeNode","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":326,"length":18,"startLine":8,"startColumn":7},"flags":0},{"kind":"COMPILATION_UNIT","name":"navigation_tree.dart","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":16},{"kind":"LIBRARY","name":"","location":{"file":"/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/nnbd_migration/lib/src/front_end/web/navigation_tree.dart","offset":0,"length":0,"startLine":1,"startColumn":1},"flags":0}]}],"isLast":true}}
2020-11-13 09:08:51,551 [251211327]  ERROR - yzer.DartAnalysisServerService - JsonNull 
java.lang.UnsupportedOperationException: JsonNull
	at com.google.gson.JsonElement.getAsString(JsonElement.java:179)
	at org.dartlang.analysis.server.protocol.Element.fromJson(Element.java:128)
	at org.dartlang.analysis.server.protocol.Element.fromJsonArray(Element.java:144)
	at org.dartlang.analysis.server.protocol.SearchResult.fromJson(SearchResult.java:88)
	at org.dartlang.analysis.server.protocol.SearchResult.fromJsonArray(SearchResult.java:99)
	at com.google.dart.server.internal.remote.processor.NotificationSearchResultsProcessor.process(NotificationSearchResultsProcessor.java:37)
	at com.google.dart.server.internal.remote.RemoteAnalysisServerImpl.processNotification(RemoteAnalysisServerImpl.java:697)
	at com.google.dart.server.internal.remote.RemoteAnalysisServerImpl.processResponse(RemoteAnalysisServerImpl.java:721)
	at com.google.dart.server.internal.remote.RemoteAnalysisServerImpl$ServerResponseReaderThread.run(RemoteAnalysisServerImpl.java:1144)
2020-11-13 09:08:51,551 [251211327]  ERROR - yzer.DartAnalysisServerService - IntelliJ IDEA 2020.3 Snapshot  Build #IC-203.SNAPSHOT 
2020-11-13 09:08:51,551 [251211327]  ERROR - yzer.DartAnalysisServerService - JDK: 11.0.8; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 
2020-11-13 09:08:51,551 [251211327]  ERROR - yzer.DartAnalysisServerService - OS: Mac OS X 
2020-11-13 09:08:51,551 [251211327]  ERROR - yzer.DartAnalysisServerService - Last Action: FindUsages 

@scheglov
Copy link
Contributor

I see, this is because of the unnamed extension in navigation_tree_renderer_test.dart.

@scheglov scheglov self-assigned this Nov 13, 2020
@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/172060 should fix DAS to return the empty string as the name of an unnamed extension.

dart-bot pushed a commit that referenced this issue Nov 13, 2020
…g for unnamed extensions.

Bug: #44196
Change-Id: Idcd6b2caa6efa37350a518d229768e9ab3e24599
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

4 participants