Skip to content

Large lists in locals/watch windows can hang #4204

@DanTup

Description

@DanTup

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions