dart-lang / dart-docker

Docker images for the Dart programming language (https://dart.dev)
BSD 3-Clause "New" or "Revised" License
67 stars 15 forks source link

Crash when building linux/amd64 image on arm64 #158

Closed blaugold closed 10 months ago

blaugold commented 12 months ago

When I try to build an image for a Dart app on an Apple Silicon device, but for linux/amd64, running dart pub get crashes with a segmentation fault.

docker build --platform linux/amd64 .
FROM dart

RUN cat > pubspec.yaml <<EOF
name: foo
dependencies:
  http: ^1.0.0
EOF

RUN dart pub get
[+] Building 2.0s (6/6) FINISHED                                                                                                                                                                                                                                         docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 183B                                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/dart:latest                                                                                                                                                                                                                           0.6s
 => CACHED [1/3] FROM docker.io/library/dart@sha256:faf300f790cadb2e34182dd75c5f14642e21c625396055a16aa967170dfb71d7                                                                                                                                                                     0.0s
 => [2/3] RUN cat > pubspec.yaml <<EOF                                                                                                                                                                                                                                                   0.1s
 => ERROR [3/3] RUN dart pub get                                                                                                                                                                                                                                                         1.3s
------                                                                                                                                                                                                                                                                                        
 > [3/3] RUN dart pub get:
1.120 Resolving dependencies...
1.235 pubspec.yaml has no lower-bound SDK constraint.
1.235 You should edit pubspec.yaml to contain an SDK constraint:
1.235 
1.235 environment:
1.235   sdk: '^3.0.0'
1.235 
1.235 See https://dart.dev/go/sdk-constraint
1.252 
1.252 ===== CRASH =====
1.252 si_signo=Segmentation fault(11), si_code=1, si_addr=0x808080808080809f
1.252 version=3.0.7 (stable) (Mon Jul 24 13:17:56 2023 +0000) on "linux_x64"
1.252 pid=8, thread=16, isolate_group=dartdev(0x40032cd800), isolate=dartdev(0x40032cf000)
1.252 os=linux, arch=x64, comp=no, sim=no
1.252 isolate_instructions=ffff7f53d000, vm_instructions=40021123e0
1.252 fp=400a553e00, sp=400a553dd8, pc=ffff7f704cf9
1.253   pc 0x0000ffff7f704cf9 fp 0x000000400a553e00 Unknown symbol
1.253   pc 0x0000ffff7f70633c fp 0x000000400a553e28 Unknown symbol
1.253   pc 0x0000ffff7e79837c fp 0x000000400a553e50 Unknown symbol
1.253   pc 0x0000ffff7e796c57 fp 0x000000400a553ea8 Unknown symbol
1.253   pc 0x0000ffff7e793f5d fp 0x000000400a553ef8 Unknown symbol
1.253   pc 0x0000ffff7e793bc0 fp 0x000000400a553f30 Unknown symbol
1.253   pc 0x0000ffff7e793a41 fp 0x000000400a553f70 Unknown symbol
1.253   pc 0x0000ffff7f70646e fp 0x000000400a553fa8 Unknown symbol
1.253   pc 0x0000ffff7e793977 fp 0x000000400a553fd8 Unknown symbol
1.253   pc 0x0000ffff7e79389f fp 0x000000400a554010 Unknown symbol
1.253   pc 0x0000ffff7e78edd3 fp 0x000000400a554070 Unknown symbol
1.253   pc 0x0000ffff7f2a0c65 fp 0x000000400a554128 Unknown symbol
1.253   pc 0x0000ffff7e78d33b fp 0x000000400a554178 Unknown symbol
1.253   pc 0x0000ffff7e78e7f6 fp 0x000000400a5541d8 Unknown symbol
1.253   pc 0x0000ffff7e78c7d5 fp 0x000000400a554260 Unknown symbol
1.253   pc 0x0000ffff7e78be16 fp 0x000000400a5542c8 Unknown symbol
1.253   pc 0x0000ffff7f585a13 fp 0x000000400a554348 Unknown symbol
1.253   pc 0x0000ffff7e789e2d fp 0x000000400a554390 Unknown symbol
1.253   pc 0x0000ffff7e789d13 fp 0x000000400a5543d8 Unknown symbol
1.253   pc 0x0000ffff7f58325d fp 0x000000400a554420 Unknown symbol
1.253   pc 0x0000ffff7f5833c5 fp 0x000000400a554460 Unknown symbol
1.253   pc 0x0000ffff7f5835c6 fp 0x000000400a554488 Unknown symbol
1.253   pc 0x0000ffff7f5d9b69 fp 0x000000400a5544c8 Unknown symbol
1.253   pc 0x0000ffff7f5dbc72 fp 0x000000400a554508 Unknown symbol
1.253   pc 0x0000ffff7f702f0c fp 0x000000400a554580 Unknown symbol
1.255   pc 0x000000400227c478 fp 0x000000400a554610 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x128
1.255   pc 0x000000400227c2fd fp 0x000000400a554670 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0xed
1.255   pc 0x000000400227e05e fp 0x000000400a5546b0 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x12e
1.256   pc 0x000000400229d91f fp 0x000000400a554c40 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message>>)+0x2bf
1.256   pc 0x00000040022c2527 fp 0x000000400a554cb0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x127
1.257   pc 0x00000040022c2b54 fp 0x000000400a554d00 dart::MessageHandler::TaskCallback()+0x1e4
1.257   pc 0x00000040023d00db fp 0x000000400a554d80 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x14b
1.257   pc 0x00000040023d0528 fp 0x000000400a554db0 dart::ThreadPool::Worker::Main(unsigned long)+0x78
1.258   pc 0x00000040023539d6 fp 0x000000400a554e70 dart+0x23539d6
1.258 -- End of DumpStackTrace
1.258 qemu: uncaught target signal 6 (Aborted) - core dumped
1.264 Aborted
------
Dockerfile:9
--------------------
   7 |     EOF
   8 |     
   9 | >>> RUN dart pub get
  10 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c dart pub get" did not complete successfully: exit code: 134
athomas commented 10 months ago

@rmacnak-google Is that a Dart or a qemu issue?

rmacnak-google commented 10 months ago

0x808080808080809f looks like a zap value 0x8080808080808080, but it isn't one used by the Dart VM, so I think it's more likely to be a Docker issue than a Dart issue.

Unfortunately it looks like Docker may not be installed on corp Macs, so I can't investigate.

athomas commented 10 months ago

@blaugold I'm closing this here because I don't think it's an issue specific to this repository, e.g. it has been reported elsewhere and is most likely an issue in Docker: https://github.com/flutter/flutter/issues/106540 https://github.com/dart-lang/sdk/issues/48420

pattobrien commented 9 months ago

I've filed a new issue with Dart-Docker after finding a way to reproduce this issue, which seems related to the use of carat syntax for the Dart SDK version in pubspec.yaml. See: https://github.com/dart-lang/dart-docker/issues/172