Open zanderso opened 4 years ago
Maybe due to something socket related. I'm seeing the error message:
Dart Socket ERROR: c:\b\s\w\ir\cache\builder\src\third_party\dart\runtime\bin\socket_win.cc:181: `reusePort` not supported for Windows
I think here are 2 separate problems. The crash and socket exception are not relative.
===== CRASH =====
ExceptionCode=-1073741819, ExceptionFlags=0, ExceptionAddress=00007FFF5F82DF23
version=2.7.0-dev.2.1.flutter-413867d678 (Wed Dec 4 11:25:19 2019 +0000) on "windows_x64"
thread=16304, isolate=(null)(0000000000000000)
Stack dump aborted because InitialRegisterCheck failed.
Crash comes from this test and this.
Running this command at \flutter\packages\flutter_tools will lead to crash(commenting out other tests).
..\..\bin\cache\dart-sdk\bin\pub.bat run test .\test\commands.shard\hermetic\attach_test.dart
..\..\bin\cache\dart-sdk\bin\pub.bat run test .\test\commands.shard\hermetic\run_test.dart
I also notice there is a low chance that tests would be hanging for both tests. This is likely to be a bug in VM.
Dart Socket ERROR: c:\b\s\w\ir\cache\builder\src\third_party\dart\runtime\bin\socket_win.cc:181: `reusePort` not supported for Windows
Socket exception comes from this test.
I know this report is old, but I saw this a few times today on LUCI builders, not sure if it's worse now?
===== CRASH =====
ExceptionCode=-1073741819, ExceptionFlags=0, ExceptionAddress=00007FFF19D7DF33
version=2.12.0-263.0.dev (dev) (Tue Jan 26 11:04:06 2021 -0800) on "windows_x64"
pid=2528, thread=2732, isolate_group=(nil)(0000000000000000), isolate=(nil)(0000000000000000)
isolate_instructions=0, vm_instructions=7ff7fbfff970
Stack dump aborted because InitialRegisterCheck failed.
Is there something helpful we can be gathering in the tests to make this more actionable?
/cc @aam
I saw this a few times today on LUCI builders, not sure if it's worse now?
I take that back, turns out I only saw it on https://github.com/flutter/flutter/pull/74838. I merged because I thought it was a flake, but it reproduced post-submit and I had to revert it. So maybe this isn't a widespread problem, but it might be a 100% repro case to help track this down.
So if we apply flutter/flutter#74838 and run that test we will see the crash? That would be a great help for debugging.
@a-siva That's what I'm thinking, though I didn't have a Windows machine handy to see if I could reproduce it myself.
cd packages\flutter_tools; ..\..\bin\cache\dart-sdk\bin\pub.bat run test -rcompact -j2 --no-color --timeout=2000ms test\general.shard
there is some weirdness(resulting in assert in https://github.com/dart-lang/sdk/blob/master/runtime/bin/eventhandler.h#L282) in the way how MemoryIOSink adds listener to stdio stream(when invoked from android_workflow.dart), and then test_core completeShutdown(https://github.com/dart-lang/test/blob/master/pkgs/test_core/lib/src/executable.dart#L53) fails to cancel stdio subscription.
I believe with MemoryIOSink in picture we are attempting to listen to stdin twice, which is not allowed and should gracefully throw a dart exception(like it does for the repro below), yet it slips through the cracks and causes internal vm assertion(in debug build)/crash(in release build).
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:async/async.dart';
main() async {
final stdinLines = new StreamQueue(stdin);
final process = await Process.start('cmd', ['/c', 'date']);
process.stdout.transform(utf8.decoder).listen((data) { print('stdout: $data'); });
process.stdin.addStream(stdin);
await process.exitCode;
stdinLines.cancel(immediate: true);
}
I bring this issue from https://github.com/Dart-Code/Dart-Code/issues/4776#issuecomment-1786988726
I see the VS Code Dart Extension crashing in 2 ways:
Here is the crash message:
===== CRASH ===== ExceptionCode=-1073741819, ExceptionFlags=0, ExceptionAddress=00007FF65FA8FAF0 version=3.1.4 (stable) (Tue Oct 17 14:55:53 2023 +0000) on "windows_x64" pid=15472, thread=6992, isolate_group=main(00000249FD2A2250), isolate=(nil)(0000000000000000) os=windows, arch=x64, comp=no, sim=no isolate_instructions=7ff65f8b6ca0, vm_instructions=7ff65f8b6cb0 fp=249fd35fab0, sp=c4d4efbd18, pc=7ff65fa8faf0 Stack dump aborted because GetAndValidateThreadStackBounds failed. pc 0x00007ff65fa8faf0 fp 0x00000249fd35fab0 Dart_IsPrecompiledRuntime+0x1ee370
The above crash message was produced during debugging when stepping "inside" the block body or expression body:
j = tokens.indexWhere((x) {
return re!.hasMatch(x.word) == true;
}, idx);
Expression body:
j = tokens.indexWhere((x) => re!.hasMatch(x.word) == true, idx);
I can inspect the variables in the left pane, but not by hovering mouse over vars. This issue is consistent over certain data structures, which are pretty basic ones, but not on others. So, it works on half of the code and crashes other times.
Is this issue of mine related to the original issue posted here?
Arrgggh!! Now I can't even put breakpoint at all!!!!! 😠
Crash
===== CRASH ===== ExceptionCode=-1073741819, ExceptionFlags=0, ExceptionAddress=00007FF6431EFAF0 version=3.1.5 (stable) (Tue Oct 24 04:57:17 2023 +0000) on "windows_x64" pid=13892, thread=6740, isolate_group=main(000002350AF69A30), isolate=(nil)(0000000000000000) os=windows, arch=x64, comp=no, sim=no isolate_instructions=7ff643016ca0, vm_instructions=7ff643016cb0 fp=2350d09e200, sp=8e523fb7f8, pc=7ff6431efaf0 Stack dump aborted because GetAndValidateThreadStackBounds failed. pc 0x00007ff6431efaf0 fp 0x000002350d09e200 Dart_IsPrecompiledRuntime+0x1ee370
Versions
D:>dart --version Dart SDK version: 3.1.5 (stable) (Tue Oct 24 04:57:17 2023 +0000) on "windows_x64"
D:>flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.19045.3570], locale en-IN) [✓] Windows Version (Installed version of Windows is version 10 or higher) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Chrome - develop for the web [✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.5) [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.84.1) [✓] Connected device (4 available) [✓] Network resources • No issues found!
So, I found that the crash happens when I have a variable from outer scope being used inside an anonymous method.
Example:
Transaction? transaction; //Outer scope var
String capturedText; //Outer scope var
PatternMatcher.instance.patternMatch(patterns, tokens,
callback: (String token, String text) { // <----- Anonymous Callback Method
// Debugging: Breakpoints hereafter crash the Dart app.
capturedText = text; // Setting outer scope var
// Checking and setting outer scope var
if (transaction == null) {
// transaction = ...
}
// ...
});
When instead of anonymous method, I switched to a private method of the class, and upgrading the local "outer scope vars" to private fields, then debugger behaved fine. No crash then.
This may help in fixing the VM.
@cnayan not sure why you clubbed the issue you are having with debugging your app under vscode into this issue which was opened for a VM shutdown crash. A new issue would have made sense, I am going to move all your comments over to a new issue so it can be tracked over there.
@a-siva Is this issue not a VS Code Dart plugin issue?
After running pub run test, all tests succeed, but then it looks like the Dart VM crashes on shutdown.
Repro instructions:
This will reproduce with a Flutter checkout from top of tree. In particular I have:
After getting a checkout under
C:\flutter\
:@a-siva @ZichangG