Skip to content

Large lists in locals/watch windows can hang #4204

Closed

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

Activity

  1. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Oct 6, 2022
  2. added this to the v3.52.0 milestone on Oct 6, 2022
  3. DanTup commented on Oct 11, 2022

    @DanTup
    MemberAuthor

    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.

  4. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Oct 11, 2022
  5. DanTup commented on Oct 18, 2022

    @DanTup
    MemberAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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