Skip to content

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

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

Closed
jensjoha opened this issue Feb 4, 2025 · 4 comments
Closed

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

jensjoha opened this issue Feb 4, 2025 · 4 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-service The VM Service Protocol, both the specification and its implementation

Comments

@jensjoha
Copy link
Contributor

jensjoha commented Feb 4, 2025

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.

@dart-github-bot
Copy link
Collaborator

Summary: Loading CPU profiles in Dart DevTools fails with JIT compilation, showing WebSocket connection and null pointer errors. AOT compilation works correctly.

@dart-github-bot dart-github-bot added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Feb 4, 2025
@a-siva
Copy link
Contributor

a-siva commented Feb 4, 2025

//cc @derekxu16

@lrhn lrhn added vm-service The VM Service Protocol, both the specification and its implementation and removed triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. labels Feb 5, 2025
@bkonyi
Copy link
Contributor

bkonyi commented Feb 5, 2025

This is likely a DevTools issue and should be filed over in flutter/devtools.

@derekxu16
Copy link
Member

Closing in favour of flutter/devtools#8866.

@derekxu16 derekxu16 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-service The VM Service Protocol, both the specification and its implementation
Projects
None yet
Development

No branches or pull requests

6 participants