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

Large lists in locals/watch windows can hang #4204

Closed
DanTup opened this issue Oct 6, 2022 · 2 comments
Closed

Large lists in locals/watch windows can hang #4204

DanTup opened this issue Oct 6, 2022 · 2 comments
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@DanTup
Copy link
Member

DanTup commented Oct 6, 2022

Reported on StackOverflow: https://stackoverflow.com/q/73921614/25124

import 'dart:typed_data';

void main() {
  Uint8List inputBytes = Uint8List.fromList(List.filled(100000000, 0));
  print(''); // Breakpoint here
}

We send a getObject() request but there's no offset/length s presumably it's trying to send the entire list back which is huge. It's possible being a Uint8List complicates things, but a normal List (List.filled(100000000, 0)) has issues too.

<== {
	"jsonrpc": "2.0",
	"method": "streamNotify",
	"params": {
		"streamId": "Debug",
		"event": {
			"type": "Event",
			"kind": "PauseBreakpoint",
			// ...
			"topFrame": {
				// ...
				"vars": [
					{
						"type": "BoundVariable",
						"name": "inputBytes",
						"value": {
							"type": "@Instance",
							// ...
							"identityHashCode": 0,
							"kind": "List", // We know it's a list
							"id": "objects/1",
							"length": 100000000 // And its length
						},
						"declarationTokenPos": 20,
						"scopeStartTokenPos": 39,
						"scopeEndTokenPos": 142
					}
				],
				"index": 0
			}
		}
	}
}

==> {
	"jsonrpc": "2.0",
	"id": "40",
	"method": "getObject",
	"params": {
		"isolateId": "isolates/2007599444226843",
		"objectId": "objects/1"
	}
}

For Uint8List the kind is Uint8List but it still has a length, and the kinds that provide lists are documented in https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#instance (string, map, and various lists).

@DanTup
Copy link
Member Author

DanTup commented Oct 11, 2022

Fixed with https://dart-review.googlesource.com/c/sdk/+/263620 in the new DAPs.

Oct-11-2022 17-04-55

Since this change is in the SDK, it'll show up in an SDK update.

@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Oct 11, 2022
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Oct 17, 2022
Fixes Dart-Code/Dart-Code#4204.
Fixes Dart-Code/Dart-Code#4213.

Change-Id: Ibd95a149e6f620efb690c24623bb6b9d04a794b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263620
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
@DanTup
Copy link
Member Author

DanTup commented Oct 18, 2022

Fixed by dart-lang/sdk@ae352fe. This will ship in an upcoming SDK release and applies to the new debug adapters (which will roll out progressively, but can be opted-in with "dart.previewSdkDaps": true in VS Code settings).

@DanTup DanTup closed this as completed Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

1 participant