Open DanTup opened 1 year ago
Thanks for the report! Can you run this:
ps -eo "rss,pcpu,etime,args"
and just paste in the lines for the process you think we should be reporting (dart, flutter_tester, ...). I want to verify that our parsing isn't going wrong, and / or the filtering we apply to make sure we're just reporting dart+flutter related processes.
If I run that through grep dart
I see this:
danny@Dannys-MacBook-Pro ~ % ps -eo "rss,pcpu,etime,args" | grep dart
111880 0.0 04:18:56 /Users/danny/Dev/Google/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester --vm-service-port=0 --start-paused --enable-checked-mode --verify-entry-points --enable-software-rendering --skia-deterministic-rendering --enable-dart-profiling --non-interactive --use-test-fonts --disable-asset-fonts --packages=/Users/danny/Dev/Google/flutter/dev/automated_tests/.dart_tool/package_config.json --flutter-assets-dir=/Users/danny/Dev/Google/flutter/dev/automated_tests/build/unit_test_assets /var/folders/b1/ftm2whhj4mb3_c4nfjhq23z00000gn/T/flutter_tools.S4PH0b/flutter_test_listener.hqexdE/listener.dart.dill
111424 0.0 04:15:20 /Users/danny/Dev/Google/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester --vm-service-port=0 --start-paused --enable-checked-mode --verify-entry-points --enable-software-rendering --skia-deterministic-rendering --enable-dart-profiling --non-interactive --use-test-fonts --disable-asset-fonts --packages=/Users/danny/Dev/Google/flutter/dev/automated_tests/.dart_tool/package_config.json --flutter-assets-dir=/Users/danny/Dev/Google/flutter/dev/automated_tests/build/unit_test_assets /var/folders/b1/ftm2whhj4mb3_c4nfjhq23z00000gn/T/flutter_tools.0LQlQj/flutter_test_listener.gwbO2M/listener.dart.dill
103032 0.0 17:14 /Users/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev --packages=/Users/danny/Dev/Google/flutter/packages/flutter_tools/.dart_tool/package_config.json /Users/danny/Dev/Google/flutter/bin/cache/flutter_tools.snapshot daemon --show-web-server-device
63932 0.0 17:14 /Users/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart devtools --machine --try-ports 10 --allow-embedding --port 9237
605388 0.0 17:14 /Users/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.59.20230214
716 0.0 00:00 grep dart
However without grep, it seems like each line is truncated:
danny@Dannys-MacBook-Pro ~ % ps -eo "rss,pcpu,etime,args"
RSS %CPU ELAPSED ARGS
27064 0.0 06:49:23 /sbin/launchd
44628 0.0 06:49:19 /usr/libexec/logd
// SNIP
605388 0.0 17:54 /Users/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart lang
648 0.0 17:31 /usr/bin/script -t 0 /dev/null xcrun xcdevice observe --both
2104 0.0 09:31 /System/Library/PrivateFrameworks/ToneLibrary.framework/Versions
6080 0.0 09:31 /System/Library/Frameworks/AudioToolbox.framework/XPCServices/co
88992 0.3 01:08 /System/Applications/Utilities/Terminal.app/Contents/MacOS/Termi
158608 0.0 00:28 /Applications/Google Chrome.app/Contents/Frameworks/Google Chrom
41528 0.0 00:27 /Applications/Google Chrome.app/Contents/Frameworks/Google Chrom
2156 0.0 17:53 /bin/zsh -il
34044 0.0 06:15:27 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
34160 0.0 06:14:20 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
33932 0.0 17:31 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
33796 0.0 04:42:09 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
34000 0.0 04:22:19 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
33820 0.0 57:41 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
33952 0.0 04:12:32 /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice obse
4184 0.0 01:08 login -pf danny
2584 0.0 01:08 -zsh
1340 0.0 00:00 ps -eo rss,pcpu,etime,args
danny@Dannys-MacBook-Pro ~ %
Not sure why it's truncated, or if that's what you're getting. I can try to debug locally if this seems odd.
Hmm, I do see the truncation - perhaps something it does for an interactive process? I don't see if when piped to a file, and don't think we see it when shelling out to that command from dart.
I'll see if I can repo the issue now w/ your output from above.
Oh I see what's going on.. this only happened for some projects, and it looks like it's when my Dart SDK path has a space in it:
danny@Dannys-MacBook-Pro ~ % ps -eo "rss,pcpu,etime,args" | grep dart
484340 81.6 00:07 /Users/danny/Dev/Dart SDKs/nightly/bin/dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.59.20230214 --instrumentation-log-file=/Users/danny/Dev/Dart-Code-Logs/server-project-analyzer.instrum.txt
^ space here
OK, gotcha - I think w/ that I'll be able to repro this issue.
Yep, confirmed. I ran the command locally and changed this:
bool _isProcessDartRelated(ProcessInfo process) {
return process.command.toLowerCase() == 'dart' ||
And now that one shows up (because my folder with a space happens to have "Dart" before the space). You might need to find a way to get ps
to output in a way that doesn't have ambiguous spaces 🙃
Yeah, that doesn't look easy. From https://unix.stackexchange.com/questions/485999/how-can-i-parse-the-output-of-ps-to-different-fields, the parsable flags of ps aren't available on the mac (ps -o '%p,%a,%c,%y'
).
In man ps
I have:
-c Change the “command” column output to just contain the executable name, rather than the full command line.
If I add this, then the paths with the problematic spaces are gone:
danny@Dannys-MacBook-Pro ~ % ps -eco "rss,pcpu,etime,args" | grep dart
112044 0.0 05:04:45 listener.dart.dill
111592 0.0 05:01:09 listener.dart.dill
63596 0.0 08:36 dart devtools --machine --try-ports 10 --allow-embedding --port 9237
608572 0.0 08:36 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.59.20230214
119120 0.0 08:11 test.dart
130892 0.0 08:02 listener.dart.dill
520 0.0 00:00 grep dart
If you do need to get those paths back, you could always grab the PIDs from here and then re-run without the -c
and look it up there?
Actually, that output seems to capture the last argument for some things :/ For example those showing listener.dart.dill
look like this in the full output:
112056 0.0 05:07:28 /Users/danny/Dev/Google/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester --vm-service-port=0 --start-paused --enable-checked-mode --verify-entry-points --enable-software-rendering --skia-deterministic-rendering --enable-dart-profiling --non-interactive --use-test-fonts --disable-asset-fonts --packages=/Users/danny/Dev/Google/flutter/dev/automated_tests/.dart_tool/package_config.json --flutter-assets-dir=/Users/danny/Dev/Google/flutter/dev/automated_tests/build/unit_test_assets /var/folders/b1/ftm2whhj4mb3_c4nfjhq23z00000gn/T/flutter_tools.S4PH0b/flutter_test_listener.hqexdE/listener.dart.dill
I would say the process here should've been flutter_tester
? 🤔
Edit: I thought maybe pgrep
could be the answer, but I can't get it to return those flutter_tester
processes no matter what pattern I provide, so I'm not convinced it's doing what I would expect 🙃
Running
dart info
says there are no Dart processes:However I have a VS Code window open that certainly has an analysis server running. If I run
ps -x | grep dart
I see a few:(FYI @devoncarew)