Cannot compile flutter engine: The compiler crashed: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:51211/jQ6Nwep21kY=/ws

This issue has been tracked since 2022-09-23.

Steps to Reproduce

Follow the steps to compile the engine. https://github.com/flutter/flutter/wiki/Compiling-the-engine#compiling-for-android-from-macos-or-linux

When in the step of ninja -C out/android_debug_unopt_x64, I see the following crash.

Expected results:

Compile normally.

Actual results:

Crash.

ninja -C out/android_debug_unopt_x64
ninja: Entering directory `out/android_debug_unopt_x64'
[1/128] ACTION //third_party/dart/runtime/observatory:build_observatory(//build/toolchain/android:clang_x64)
FAILED: gen/third_party/dart/runtime/observatory/observatory/web/main.dart.js gen/third_party/dart/runtime/observatory/observatory/web/main.dart.js.map 
vpython3 ../../third_party/dart/build/gn_run_binary.py compiled_action /Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/dart --dfe=/Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot compile js -o /Volumes/MyExternal/ExternalRefCode/engine/src/out/android_debug_unopt_x64/gen/third_party/dart/runtime/observatory/observatory/web/main.dart.js --packages=/Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/.dart_tool/package_config.json --no-sound-null-safety /Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/runtime/observatory/web/main.dart --enable-asserts
Command failed: /Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/dart --dfe=/Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot compile js -o /Volumes/MyExternal/ExternalRefCode/engine/src/out/android_debug_unopt_x64/gen/third_party/dart/runtime/observatory/observatory/web/main.dart.js --packages=/Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/.dart_tool/package_config.json --no-sound-null-safety /Volumes/MyExternal/ExternalRefCode/engine/src/third_party/dart/runtime/observatory/web/main.dart --enable-asserts
output: Info: Compiling without sound null safety
../../third_party/dart/runtime/observatory/lib/src/service/object.dart:2138:3:
Hint: This 'noSuchMethod' implementation is guaranteed to throw an exception. The generated code will be smaller if it is rewritten.
Rewrite to 'noSuchMethod(Invocation i) => super.noSuchMethod(i);'.
  noSuchMethod(_) => throw "Unimplemented ServiceMap method";
  ^
The compiler crashed: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:51211/jQ6Nwep21kY=/ws


ninja: build stopped: subcommand failed.

I workaround by patching thirdparty/dart with this:

diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index f704353ab67..a998f159322 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -2135,7 +2135,9 @@ class ServiceMap extends ServiceObject
   int get length => _map.length;
 
   // Suppress compile-time error about missing Map methods.
-  noSuchMethod(_) => throw "Unimplemented ServiceMap method";
+// NOTE HACK!!!
+noSuchMethod(Invocation i) => super.noSuchMethod(i);
+  // noSuchMethod(_) => throw "Unimplemented ServiceMap method";
 
   String toString() => "ServiceMap($_map)";
 }

But this is just a hack - flutter source code should be compileable IMHO.

Update: I see what is going wrong. It is indeed not that problem, but because I set export http_proxy=..., so flutter somehow cannot connect to its components.
The issue remains here (closed) just in case someone has the same problem as me.

Code sample
Logs
using master branch
More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-04
Star Count 145499
Watcher Count 3567
Fork Count 23393
Issue Count 11206

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date