Segmentation fault on x86_64 with MacOS Virtualization Framework enabled
- [X] I have tried with the latest version of Docker Desktop
- [X] I have tried disabling enabled experimental features
- [X] I have uploaded Diagnostics
- Diagnostics ID: 42EDF249-C0A8-4A3B-A709-4B2ADD41E5EF/20230505143852
Expected behavior
After a fresh local install of a Laravel project + Breeze (Vue), trying to build for production (sail npm run build) or starting a local hmr server (sail npm run dev) should work properly (using Docker for Mac on Intel Chip, v4.19.0)
Actual behavior
Both commands thows a Segmentation Fault error without further info.
VITE v4.3.3 ready in 727 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.240.7.5:5173/
➜ press h to show help
LARAVEL v10.9.0 plugin v0.7.4
➜ APP_URL: http://mysite.test
Segmentation fault
Information
Switching back to Docker for Mac v4.18.0 works as expected.
Possible workaround: disable Virtualization framework on v4.19+
Steps to reproduce the behavior
- Create a fresh Laravel project (
curl -s "https://laravel.build/example-app" | bash) - Install Laravel Breeze package (https://laravel.com/docs/10.x/starter-kits#laravel-breeze-installation) with the Vue stack
- Run
sail npm run devshould throw the Segmentation Fault error
@antoniofrignani, would it be possible to submit a diagnostic report and then add the Diagnostics ID here?
@MihaelaStoica i've just updated my comment with a diagnostic ID
I also have this issue.
There is no need to create a full Laravel project though. Installing Vite is enough to reproduce this issue:
- Create a new Vite project via
docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app node npm create vite@latest - Change directory into the new Vite project:
cd vite-project - Install the Vite package via npm:
docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app node npm install - Build for production or start a local hmr server:
docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app node npm run dev/docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app node npm run build
Downgrading to 4.18.0 via https://docs.docker.com/desktop/release-notes/#4180 without changing the version of Vite is also a working workaround for me.
I also have access to a MacBook of a different model where this issue does not occur, so this might be hard to reproduce.
Specs of the MacBook that has the issue:
13" MacBook Pro 2020
CPU: 2,3GHz Quad-Core Intel Core i7
RAM: 16 GB 3733 MHz LPDDR4X
OS: Ventura 13.3.1 (a)
Specs of the MacBook without the issue:
15" MacBook Pro 2017
CPU: 2,9GHz Quad-Core Intel Core i7
RAM: 16 GB 2133 MHz LPDDR3
OS: Ventura 13.3.1 (a)
I reported this issue to the yarn project (in hindsight not sure if I should have filed it here or at the node project instead). This issue here looks very similar to what I reported at https://github.com/yarnpkg/berry/issues/5420. The issue at the yarn repository contains a minimal case to reproduce.
For me, this issue happens 100% of the time, for coworkers (almost identical hardware) it does not fail at all.
@irobin591 yes the issue is not direcly related to the framework itself, thanks for reproducing it with bare minimum boilerplate.
I'll watch the issue on the node/yarn side too since this seems strictly related, thanks @tisba for reporting it here.
I can confirm that downgrading to Docker Desktop 4.18.0 (104112) fixes the issue for yarn install seg fauting (see comment above). Thanks for the hint @irobin591 - I can at least build assets again :)
Update I only see the issue on x86. On arm64 (macOS 13.3.1 (a) (22E772610a)) Docker Desktop 4.19.0 works fine, without segmentation fault. So it looks like 4.19.0 broke something specifically on Intel.
I use this to test:
#!/bin/sh
# run via
#
# docker run -it --rm -v "$(pwd)/test.sh":/app/test.sh:ro -w /app node:18.16 /app/test.sh
set -e
cat << EOF > ./package.json
{
"packageManager": "[email protected]",
"dependencies": {
"@rails/ujs": "7.0.4"
}
}
EOF
corepack enable
npm install -g [email protected]
printf "uname -a: %s\n" "$(uname -a)"
printf "Node version: %s\n" "$(node --version)"
printf "Yarn version: %s\n" "$(yarn --version)"
printf "npm version: %s\n" "$(npm --version)"
printf "\n\n"
printf "Running: yarn install\n"
yarn install
@sam-thibault @MihaelaStoica: Can we provide something else to help with acknowledging/analysing the issue? (looking at the status/0-more-info-needed label)
I have the same problem on a Laravel project with sail when I do the command sail npm run dev I get :
dev vite
Segmentation fault
Docker version 23.0.5, build bc4487a Docker Compose version v2.17.3 Node v18.16.0 NPM 9.6.7
In case you missed it, @julienallexandre, downgrading Docker Desktop one version seems to help until the issue is identified and fixed.
@tisba thanks yes that's what I did :)
Ran into the same issue today. I was using: Node v19 Yarn 3.5.0 2.3 GHz Quad-Core Intel Core i7 Docker 4.19.0 & 4.20.1
I continually ran into silently failing yarn installs. Eventually, I tried a yarn install in the Docker terminal itself and received a seg fault.
Shoutout to you @tisba - I was losing my mind all afternoon.
Please fix this issue. @docker-robot
I can confirm that with Docker Desktop 4.20.1 (110738) the problem persists under x86 (macOS 13.3.1 (a) (22E772610a)).
None of my Apple Silicon devices show this problem, also tested with latest Docker Desktop 4.20.1. Update I also can't get it to crash on Apple Silicon using Rosetta x86 emulation.
I have same problem on i9 intel iMac. I can reproduce on latest docker desktop. Downgrading to 4.18 fixes issue but has networking problems of its own on Ventura 13.4.
Interestingly, I can reproduce with node v18 and 20 buster/bullseye images. However node v16 works fine.
Updated to macOS 13.4 (22F66) and the problem still persists.
As an added piece of information... I have 2 development setups I am currently working in and experiencing this same issue. I am using the bullseye images for my containers.
- Home: i9 Intel iMac, node versions v14, v16, v17 can build successfully, v18-20 results in seg fault
- Work: i5 Intel iMac, node versions v14-20 can all build successfully
Both machines are running: macOS 13.4 / Docker Desktop v4.20.1 / Node v18.16.0
Same problem with version 4.20.1, reverting to v 4.18 is the only working workaround afaik
I had same issue.
MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) Monterey 12.6.2 Intel Core i7
But it's fixed after downgraded to 4.18.0 without any changes of dockerfile, thank you.
I had the same issue, but I use Laravel Mix instead of Vite. Downgrading Docker desktop to 4.18.0 did also the trick for me.
Still preproducable with 4.21.0 (113844) on Ventura 13.4.1 (22F82). Do the issue labels need to be updated to reflect that the bug is still present, @sam-thibault?
Managed to reproduce the issue on macOS Ventura 13.4.1 (22F82) with Docker Desktop 4.20.1 (110738) and Docker version 24.0.2, build cb74dfc
Problem still relevant with latest 4.21.1 version
@antoniofrignani confirming as well the issue is still relevant on 4.21.1 with an Intel Mac.
any update for Docker 4.21.1 with Intel mac?
any update for Docker 4.21.1 with Intel mac?
yarn still crashing on 4.21.1
Same issue on this laptop, still failing:
13" MacBook Pro 2020
CPU: 2GHz Quad-Core Intel Core i5
RAM: 16 GB 3733 MHz LPDDR4X
OS: Ventura 13.2.1
Both Vite and Vitest were returning Segmentation fault. I tried everything I could think of and the only thing that actually worked was downgrading Docker from v4.21.1 to v4.18.0 - Thank you guys so much!
I was using npm though, not yarn. The error looked like this:
2023-07-31 16:33:29 > vite --debug
2023-07-31 16:33:29
2023-07-31 16:33:31 npm ERR! path /home/app/frontend
2023-07-31 16:33:31 npm ERR! command failed
2023-07-31 16:33:31 npm ERR! signal SIGSEGV
2023-07-31 16:33:31 npm ERR! command sh -c -- vite --debug
2023-07-31 16:33:31
2023-07-31 16:33:31 npm ERR! A complete log of this run can be found in:
+1
Experiencing this issue with a laravel project using npm with vite.
Can confirm that downgrading to v4.18.0 fixes the issue for some reason.
@sam-thibault is this somehow on the radar. I am following this ticket for quiet some time and just like anyone here I am stuck on the last working release.
I suppose nobody found the root cause yet but might be easier for a docker dev to debug where that segfault comes from.
I've had a similar issue with running the AWS cdk inside containers under Docker Desktop on Mac. After attempting the version downgrade without success. I tried un-checking "Use Virtualization framework" and this appears to have resolved my issues. It may be worth trying here since AWS cdk is a nodejs package there could be a common thread there.
I've had a similar issue with running the AWS cdk inside containers under Docker Desktop on Mac. After attempting the version downgrade without success. I tried un-checking "Use Virtualization framework" and this appears to have resolved my issues. It may be worth trying here since AWS cdk is a nodejs package there could be a common thread there.
I've been monitoring this thread for a while and this solution proposed by @AbbyRH is the first one that solves the issue, I'm running Docker Desktop for Mac v4.21.1 (114176) and I'm finally able to run Vite without the seg fault error, thanks @AbbyRH!
Confirmed that the problem is somewhere in-between Docker Engine and MacOS Virtualization Framework, it now works disabling the latter on v 4.22.
This seems to be the only working workaround as of now. Thanks @AbbyRH for sharing your solution.