Skip to content

Dart DevTools: Loading CPU profile in JIT doesn't work #60041

@jensjoha

Description

@jensjoha

Say I run

out/ReleaseX64/dart-sdk/bin/dart --enable-vm-service --pause_isolates_on_exit --profiler pkg/_fe_analyzer_shared/test/scanner_benchmark.dart pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes

and launch devtools. I go to the "CPU Profiler" tab, click "Load all CPU samples". Then it just sits there, "Fetching CPU samples" forever.
In the javascript console I can see this stuff:

completePageInitializationIfReady_  {message: 'The message port closed before a response was received.'}

Attempting to load DevTools with canvaskit renderer.

Version: 2.43.0, Renderer: canvaskit

WebSocket connection to 'ws://127.0.0.1:46349/uqClOtdj8j8=' failed: 

[Dart Tooling Daemon connection failed.]: WebSocketChannelException: Instance of 'minified:OT'

DevTools log level changed to INFO

Could not find release notes for DevTools version 2.43.0.

Attempted to call extension 'ext.flutter.inspector.structuredErrors', but no service with that name exists

Could not time async operation "cpuProfileProcessingTime" because an exception was thrown:
Null check operator used on a null value
TypeError: Cannot read properties of undefined (reading 'd')
    at bNN.$2$current$parent (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:89924:44)
    at bNN.$2$current$parent (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:89928:83)
    at Object.cAi (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:14693:32)
    at http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:14601:129
    at bOY.a (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:5131:63)
    at bOY.$2 (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:62218:14)
    at Object.k (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:5117:10)
    at Object.To (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:14631:10)
    at http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:50796:14
    at bOY.a (http://127.0.0.1:8181/EY_ENZZmO58=/devtools/main.dart.js:5131:63)

Uncaught Error: Null check operator used on a null value
    at bNN.$2$current$parent (cpu_profile_model.dart:1261:39)
    at bNN.$2$current$parent (cpu_profile_model.dart:1372:9)
    at Object.cAi (cpu_profile_model.dart:1380:5)
    at cpu_profile_model.dart:562:50
    at bOY.a (async_patch.dart:311:19)
    at bOY.$2 (async_patch.dart:336:23)
    at Object.k (async_patch.dart:241:3)
    at Object.To (cpu_profile_model.dart:556:11)
    at cpu_profile_service.dart:64:42
    at bOY.a (async_patch.dart:311:19)

[zoneGuarded]: Null check operator used on a null value
../../../lib/src/screens/profiler/cpu_profile_model.dart 1261:39                   _extension#0|generateStackFramesJson.processStackFrame
../../../lib/src/screens/profiler/cpu_profile_model.dart 1372:9                    _extension#0|generateStackFramesJson.processStackFrame
../../../lib/src/screens/profiler/cpu_profile_model.dart 1380:5                    CpuSamples.<anonymous extension>.generateStackFramesJson
../../../lib/src/screens/profiler/cpu_profile_model.dart 562:50                    CpuProfileData.generateFromCpuSamples
org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart 311:19  _wrapJsFunctionForAsync
org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart 336:23  _wrapJsFunctionForAsync.<anonymous function>
org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart 241:3   _asyncStartSync
../../../lib/src/screens/profiler/cpu_profile_model.dart 556:11                    CpuProfileData.generateFromCpuSamples
../../../lib/src/screens/profiler/cpu_profile_service.dart 64:42                   CpuProfilerExtension.getCpuProfile
org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart 311:19  _wrapJsFunctionForAsync

I am running through a ssh tunnel with port 8181 open btw.

Worth noting though is that if I instead do

pkg/vm/tool/precompiler2 pkg/_fe_analyzer_shared/test/scanner_benchmark.dart test.aot
out/ReleaseX64/dartaotruntime --enable-vm-service --pause_isolates_on_exit --profiler test.aot pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes

it works. It loads the profile and there are no errors in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)vm-serviceThe VM Service Protocol, both the specification and its implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions