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

'isNotEmpty' was called on null in CompletionDomainHandler.getSuggestionDetails #36667

Closed
DanTup opened this issue Apr 18, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@DanTup
Copy link
Member

commented Apr 18, 2019

@bwilkerson @scheglov I can't reproduce this, but I thought it may be worth raising in case you can figure out what happened from the stack. I opened a project and got this error from the server. Unfortunately I didn't get a full log from the server because I left the error report open while I finished what I was in the middle of, then forgot about it for a few hours by which time it was overwritten ;(

Exception from analysis server (running from VSCode / Dart Code)

### Versions

- Flutter SDK 1.5.3-pre.17
- Visual Studio Code 1.33.1
- Dart Code 2.26.0-dev

### Analyzer Info

The analyzer was launched using the arguments:

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

Exception

Failed to handle completion domain request: {id: 101, method: completion.getSuggestionDetails, params: {file: /Users/dantup/Dev/Google/flutter/examples/flutter_gallery/lib/gallery/options.dart, id: 79, label: CredentialsContainer, offset: 13587}, clientRequestTime: 1555585799663}

NoSuchMethodError: The getter 'isNotEmpty' was called on null.
Receiver: null
Tried calling: isNotEmpty
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      PosixStyle.rootLength (package:path/src/style/posix.dart:32:14)
#2      Context.isAbsolute (package:path/src/context.dart:182:41)
#3      AnalysisDriver._throwIfNotAbsolutePath (package:analyzer/src/dart/analysis/driver.dart:1875:40)
#4      AnalysisDriver.getUnitElement (package:analyzer/src/dart/analysis/driver.dart:980:5)
#5      AnalysisDriver.getLibraryByUri (package:analyzer/src/dart/analysis/driver.dart:757:42)
<asynchronous suspension>
#6      AnalysisSessionImpl.getLibraryByUri (package:analyzer/src/dart/analysis/session.dart:111:38)
<asynchronous suspension>
#7      CompletionDomainHandler.getSuggestionDetails (package:analysis_server/src/domain_completion.dart:205:53)
<asynchronous suspension>
#8      CompletionDomainHandler.handleRequest.<anonymous closure> (package:analysis_server/src/domain_completion.dart:259:9)
#9      _rootRun (dart:async/zone.dart:1124:13)
#10     _CustomZone.run (dart:async/zone.dart:1021:19)
#11     _runZoned (dart:async/zone.dart:1516:10)
#12     runZoned (dart:async/zone.dart:1500:12)
#13     CompletionDomainHandler.handleRequest (package:analysis_server/src/domain_completion.dart:255:12)
#14     AnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/analysis_server.dart:337:45)
#15     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#16     AnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/analysis_server.dart:333:50)
#17     _rootRun (dart:async/zone.dart:1124:13)
#18     _CustomZone.run (dart:async/zone.dart:1021:19)
#19     _runZoned (dart:async/zone.dart:1516:10)
#20     runZoned (dart:async/zone.dart:1500:12)
#21     AnalysisServer.handleRequest (package:analysis_server/src/analysis_server.dart:332:5)
#22     ByteStreamServerChannel._readRequest.<anonymous closure> (package:analysis_server/src/channel/byte_stream_channel.dart:174:16)
#23     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#24     ByteStreamServerChannel._readRequest (package:analysis_server/src/channel/byte_stream_channel.dart:165:47)
#25     ByteStreamServerChannel.listen.<anonymous closure> (package:analysis_server/src/channel/byte_stream_channel.dart:110:26)
#26     _rootRunUnary (dart:async/zone.dart:1132:38)
#27     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#28     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#29     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#30     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#31     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#32     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#33     _StringAdapterSink.add (dart:convert/string_conversion.dart:236:11)
#34     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:150:13)
#35     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:125:5)
#36     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)
#37     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#38     _rootRunUnary (dart:async/zone.dart:1132:38)
#39     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#40     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#41     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#42     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#43     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#44     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#45     _StringAdapterSink.add (dart:convert/string_conversion.dart:236:11)
#46     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:241:7)
#47     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:312:20)
#48     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:305:5)
#49     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#50     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#51     _rootRunUnary (dart:async/zone.dart:1132:38)
#52     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#53     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#54     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#55     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#56     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#57     _StreamController._add (dart:async/stream_controller.dart:640:7)
#58     _StreamController.add (dart:async/stream_controller.dart:586:5)
#59     _Socket._onData (dart:io-patch/socket_patch.dart:1774:41)
#60     _rootRunUnary (dart:async/zone.dart:1136:13)
#61     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#62     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#63     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#64     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#65     _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#66     _StreamController._add (dart:async/stream_controller.dart:640:7)
#67     _StreamController.add (dart:async/stream_controller.dart:586:5)
#68     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1323:33)
#69     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:844:14)
#70     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#71     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#72     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#73     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)

Diagnostics requested after the error occurred are:

[
    {
        "name": "/Users/dantup/Dev/Google/flutter/examples/flutter_gallery",
        "explicitFileCount": 124,
        "implicitFileCount": 1024,
        "workItemQueueLength": 2,
        "cacheEntryExceptions": []
    }
]
@scheglov

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2019

Yes, the stack trace gives me some idea.
We took the library id (79), got the library URI, and requested the LibraryElement.
However we probably were not able to resolve the URI, got unresolvedFile, with null path.

I don't understand why we got such unresolved URI. If we have DAS log from the beginning, with all completion.availableSuggestions, we could analyze it some more. I think I will add some checks to prevent NPE, but it is still not completely clear why we got such wrong URI.

@scheglov scheglov self-assigned this Apr 18, 2019

@DanTup

This comment has been minimized.

Copy link
Member Author

commented Apr 18, 2019

Ok, if I see it again I'll make sure I get a log.. or maybe I should have an option not to just overwrite the logs in VS Code =D

@scheglov

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2019

@scheglov scheglov closed this Apr 18, 2019

dart-bot pushed a commit that referenced this issue Apr 18, 2019

Issue 36667. Check for unresolved URI in getLibraryByUri().
R=brianwilkerson@google.com

Bug: #36667
Change-Id: If35719b350c2f26edbb7cbe42f51af896aa41fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99713
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
You can’t perform that action at this time.