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

Fatal analysis server error requesting statement completion #33034

Closed
DanTup opened this issue May 3, 2018 · 5 comments
Closed

Fatal analysis server error requesting statement completion #33034

DanTup opened this issue May 3, 2018 · 5 comments
Assignees
Labels
analyzer-completion Issues with the analysis server's code completion feature

Comments

@DanTup
Copy link
Collaborator

DanTup commented May 3, 2018

  • Dart SDK 2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0
  • Flutter SDK 0.3.6-pre.70
  • Visual Studio Code - Insiders 1.23.0-insider
  • Dart Code 2.13.0-dev

I sent an edit that replaced the document with 34 characters that look like this:

main() {
  if (true
}

I sent a getStatementCompletion request after the true and got a fatal server error:

[13:28:52]: ==> {"id":"13","method":"analysis.updateContent","params":{"files":{"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart":{"edits":[{"id":"","length":34,"offset":0,"replacement":"\nmain() {\n  if (true\n}\n\t\t"}],"type":"change"}}}}
[13:28:52]: <== {"id":"13","result":{}}
[13:28:52]: <== {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
[13:28:52]: <== {"event":"analysis.errors","params":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","errors":[{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":21,"length":1,"startLine":4,"startColumn":1},"message":"Expected a statement.","code":"missing_statement","hasFix":false},{"severity":"ERROR","type":"SYNTACTIC_ERROR","location":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":21,"length":1,"startLine":4,"startColumn":1},"message":"Expected to find ')'.","code":"expected_token","hasFix":false}]}}
[13:28:52]: <== {"event":"analysis.occurrences","params":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","occurrences":[{"element":{"kind":"FUNCTION","name":"main","location":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":1,"length":4,"startLine":2,"startColumn":1},"flags":8,"parameters":"()","returnType":"dynamic"},"offsets":[1],"length":4}]}}
[13:28:52]: <== {"event":"analysis.closingLabels","params":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","labels":[]}}
[13:28:52]: <== {"event":"analysis.outline","params":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name":"<unit>","location":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":0,"length":22,"startLine":1,"startColumn":1},"flags":0},"offset":0,"length":22,"codeOffset":0,"codeLength":22,"children":[{"element":{"kind":"FUNCTION","name":"main","location":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":1,"length":4,"startLine":2,"startColumn":1},"flags":8,"parameters":"()","returnType":""},"offset":1,"length":21,"codeOffset":1,"codeLength":21}]}}}
[13:28:52]: <== {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
[13:28:52]: ==> {"id":"14","method":"edit.getStatementCompletion","params":{"file":"/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart","offset":20}}
[13:28:52]: <== {"event":"server.error","params":{"isFatal":true,"message":"Failed to handle request: {id: 14, method: edit.getStatementCompletion, params: {file: /Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart, offset: 20}}","stackTrace":"RangeError: Value not in range: 10\n#0      // ...

Versions

  • Dart SDK 2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0
  • Flutter SDK 0.3.6-pre.70
  • Visual Studio Code - Insiders 1.23.0-insider
  • Dart Code 2.13.0-dev

Analyzer Info

The analyzer was launched using the arguments:

/Users/dantup/Dev/Google/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot
--client-id=Dart-Code.dart-code
--client-version=2.13.0-dev

Exception (fatal)

Failed to handle request: {id: 14, method: edit.getStatementCompletion, params: {file: /Users/dantup/Dev/Dart-Code/test/test_projects/hello_world/lib/empty.dart, offset: 20}}

RangeError: Value not in range: 10
#0      _StringBase.substring (dart:core-patch/dart:core/string_patch.dart:366)
#1      StatementCompletionProcessor._complete_keywordCondition (package:analysis_server/src/services/completion/statement/statement_completion.dart:811)
#2      StatementCompletionProcessor._complete_ifOrWhileStatement (package:analysis_server/src/services/completion/statement/statement_completion.dart:744)
#3      StatementCompletionProcessor._complete_ifStatement (package:analysis_server/src/services/completion/statement/statement_completion.dart:787)
#4      StatementCompletionProcessor.compute (package:analysis_server/src/services/completion/statement/statement_completion.dart:203)
<asynchronous suspension>
#5      EditDomainHandler.getStatementCompletion (package:analysis_server/src/edit/edit_domain.dart:307)
<asynchronous suspension>
#6      EditDomainHandler.handleRequest (package:analysis_server/src/edit/edit_domain.dart:346)
#7      AnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/analysis_server.dart:722)
#8      _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:210)
#9      AnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/analysis_server.dart:718)
#10     _rootRun (dart:async/zone.dart:1126)
#11     _CustomZone.run (dart:async/zone.dart:1023)
#12     runZoned (dart:async/zone.dart:1490)
#13     AnalysisServer.handleRequest (package:analysis_server/src/analysis_server.dart:717)
#14     ByteStreamServerChannel._readRequest.<anonymous closure> (package:analysis_server/src/channel/byte_stream_channel.dart:172)
#15     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:210)
#16     ByteStreamServerChannel._readRequest (package:analysis_server/src/channel/byte_stream_channel.dart:163)
#17     ByteStreamServerChannel.listen.<anonymous closure> (package:analysis_server/src/channel/byte_stream_channel.dart:108)
#18     _rootRunUnary (dart:async/zone.dart:1134)
#19     _CustomZone.runUnary (dart:async/zone.dart:1031)
#20     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
#21     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#22     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#23     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
#24     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
#25     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
#26     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154)
#27     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129)
#28     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189)
#29     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
#30     _rootRunUnary (dart:async/zone.dart:1134)
#31     _CustomZone.runUnary (dart:async/zone.dart:1031)
#32     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
#33     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#34     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#35     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
#36     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
#37     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
#38     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273)
#39     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348)
#40     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341)
#41     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86)
#42     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
#43     _rootRunUnary (dart:async/zone.dart:1134)
#44     _CustomZone.runUnary (dart:async/zone.dart:1031)
#45     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
#46     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#47     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#48     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:763)
#49     _StreamController._add (dart:async/stream_controller.dart:639)
#50     _StreamController.add (dart:async/stream_controller.dart:585)
#51     _Socket._onData (dart:io-patch/socket_patch.dart:1674)
#52     _rootRunUnary (dart:async/zone.dart:1138)
#53     _CustomZone.runUnary (dart:async/zone.dart:1031)
#54     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933)
#55     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
#56     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
#57     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:763)
#58     _StreamController._add (dart:async/stream_controller.dart:639)
#59     _StreamController.add (dart:async/stream_controller.dart:585)
#60     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1247)
#61     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:799)
#62     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#63     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#64     _runPendingImmediateCallback (dart:isolate-patch/dart:isolate/isolate_patch.dart:113)
#65     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:166)

Diagnostics requested after the error occurred are:

[
    {
        "name": "/Users/dantup/Dev/Dart-Code/test/test_projects/hello_world",
        "explicitFileCount": 8,
        "implicitFileCount": 93,
        "workItemQueueLength": 0,
        "cacheEntryExceptions": []
    }
]

@bwilkerson @scheglov I get this both on stable (1.24) and a recent Flutter build. I wonder if it's similar to the refactor issue we saw (it didn't wait for the edits to be applied)? This is in a test, so there was very little time between the edit and the completion request.

@DanTup
Copy link
Collaborator Author

DanTup commented May 3, 2018

I wonder if it's similar to the refactor issue we saw (it didn't wait for the edits to be applied)?

Probably not; inserting a 5 second delay after sending the edit doesn't seem to stop the issue.

@scheglov
Copy link
Contributor

scheglov commented May 3, 2018

I can reproduce the problem in a unit test.

@scheglov scheglov self-assigned this May 3, 2018
@scheglov scheglov added the analyzer-completion Issues with the analysis server's code completion feature label May 3, 2018
@scheglov
Copy link
Contributor

scheglov commented May 3, 2018

@scheglov scheglov closed this as completed May 3, 2018
dart-bot pushed a commit that referenced this issue May 3, 2018
…renthesis.

Bug: #33034
Change-Id: I87a47e5ddc41596b4bcd0c07d250a7afb00546ef
Reviewed-on: https://dart-review.googlesource.com/53680
Reviewed-by: Steve Messick <messick@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@DanTup
Copy link
Collaborator Author

DanTup commented May 3, 2018

Is it reasonable to bump the server version so I can tell when we have the fix for this? Otherwise if users hit it we'll be prompting them to send error reports.

@scheglov
Copy link
Contributor

scheglov commented May 3, 2018

dart-bot pushed a commit that referenced this issue May 3, 2018
Bug: #33034
Change-Id: I1dc4bfb97d2fae7a4c57baa056749fa520f7ea88
Reviewed-on: https://dart-review.googlesource.com/53684
Reviewed-by: Phil Quitslund <pquitslund@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
analyzer-completion Issues with the analysis server's code completion feature
Projects
None yet
Development

No branches or pull requests

2 participants