Skip to content

Segmentation fault on x86_64 with MacOS Virtualization Framework enabled #6824

Closed

Description

@antoniofrignani
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • 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

  1. Create a fresh Laravel project (curl -s "https://laravel.build/example-app" | bash)
  2. Install Laravel Breeze package (https://laravel.com/docs/10.x/starter-kits#laravel-breeze-installation) with the Vue stack
  3. Run sail npm run dev should throw the Segmentation Fault error

Activity

  1. MihaelaStoica commented on May 3, 2023

    @MihaelaStoica

    @antoniofrignani, would it be possible to submit a diagnostic report and then add the Diagnostics ID here?

  2. antoniofrignani commented on May 5, 2023

    @antoniofrignani
    Author

    @MihaelaStoica i've just updated my comment with a diagnostic ID

  3. irobin591 commented on May 8, 2023

    @irobin591

    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)
    
  4. tisba commented on May 8, 2023

    @tisba

    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 yarnpkg/berry#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.

  5. antoniofrignani commented on May 9, 2023

    @antoniofrignani
    Author

    @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.

  6. tisba commented on May 11, 2023

    @tisba

    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": "yarn@3.5.1",
        "dependencies": {
            "@rails/ujs": "7.0.4"
        }
    }
    EOF
    
    corepack enable
    
    npm install -g npm@9.6.5
    
    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
  7. tisba commented on May 16, 2023

    @tisba

    @sam-thibault @MihaelaStoica: Can we provide something else to help with acknowledging/analysing the issue? (looking at the status/0-more-info-needed label)

  8. changed the title [-]Node / NPM / Vite Segmentation fault on fresh Laravel Project using Sail[/-] [+]Segmentation fault on x86_64 linux on yarn install with minimal package.json[/+] on May 16, 2023
  9. julienallexandre commented on May 23, 2023

    @julienallexandre

    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

  10. tisba commented on May 23, 2023

    @tisba

    In case you missed it, @julienallexandre, downgrading Docker Desktop one version seems to help until the issue is identified and fixed.

  11. julienallexandre commented on May 24, 2023

    @julienallexandre

    @tisba thanks yes that's what I did :)

  12. 87 remaining items

  13. sergioharo commented on Apr 25, 2024

    @sergioharo

    @dgageot I can reproduce on 4.29, iMac 2020 Intel i9 running Sonoma 14.4.1

    You need to make sure you have Use Virtualization Framework enabled AND VirtioFS enabled.

    Running the test command above gets me

    docker run -it -e NG_CLI_ANALYTICS=false node:18-slim npx --yes --package @angular/cli -- ng version
    Segmentation fault
    npm notice
    npm notice New minor version of npm available! 10.5.0 -> 10.6.0
    npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.6.0
    npm notice Run npm install -g npm@10.6.0 to update!
    npm notice

    Using Virtualization Framework AND gRPC Fuse seems to work.

    As does NO virtualization framework AND osxfs

    Strangely after going back to VirtioFS, node:18-slim started working but node:19-slim still gets a segfault. Node 20+ seem to work.

  14. eweidner commented on Apr 25, 2024

    @eweidner

    @dgageot I don't have a machine in a state to test this again right now, but as of May 2023, Nov 2023, and late Feb 2024 with all machines up to date on latest MacOS and Docker Desktop at that time I had 4 13" MBP (2020, Intel, i7 cpu) and 1 13" Macbook Air (2020, Intel, i7) all failed on this. I had 1 15" MBP (2018, Intel, i7) and 1 16" MBP (2019, Intel, i9) that did NOT have the problem with Mac Virtualization Framework on.

    Turning off the Mac Virtualization Framework fixed all machines.

    Also in my testing in November, node:16-slim did NOT have the problem. node:18-slim and node:20-slim DID have the problem. node:22-slim (not GA yet) did NOT have the problem.

    Hope that helps.

  15. dgageot commented on Apr 26, 2024

    @dgageot
    Member

    Keeping you posted: For now, we failed to reproduce on four different Intel Macs. Each time, we enabled Virtualization Framework enabled AND VirtioFS.
    FWIW, I wonder howVirtioFS could have an impact, since both of the reproductions you shared don't use file sharing at all.

  16. dgageot commented on Apr 26, 2024

    @dgageot
    Member

    OK, we've tried six Mac<=2018 and had no issue
    But we found a 2020 MacBookPro with the issue!
    I'll keep you posted

  17. antoniofrignani commented on Apr 26, 2024

    @antoniofrignani
    Author

    @dgageot thank for stepping in.

    If that helps, you can have a look at the diagnostics i have uploaded when i first opened the issue.
    Unfortunately I've switched to another tool the get the job done, so i can't help with the issue anymore.

  18. dgageot commented on Apr 26, 2024

    @dgageot
    Member

    Here is an internal build which we think solves this issue. Could you give it a try?
    https://desktop-stage.docker.com/mac/main/amd64/148395/Docker.dmg

  19. Amli commented on Apr 27, 2024

    @Amli

    A few days ago we upgraded our stack to nodejs 20 and suffered the same issue as described here (precisely a segfault when running webpack during image build with no mount) on a macbook pro 2020.

    @dgageot I gave your internal build a try, switched back to use of the Virtualization Framework and used it yesterday for a few hours, everything works fine now 👏

    I'll let others confirm that it works for them too.

    Thanks for taking the time to reproduce and fix the issue !

  20. http-teapot commented on Apr 28, 2024

    @http-teapot

    I can confirm that it works on our end, too. Thank you for fixing this issue!

  21. dgageot commented on Apr 29, 2024

    @dgageot
    Member

    FYI, the fix is planned for Docker Desktop v4.30.0

  22. pablo-psi commented on Apr 29, 2024

    @pablo-psi

    FYI, the fix is planned for Docker Desktop v4.30.0

    Great, thank you for fixing the issue! 🙏

  23. chaizeg commented on May 6, 2024

    @chaizeg

    Closing this issue because a fix has been released in Docker Desktop 4.30.0 . See the release notes for more details.

  24. ciekawy commented on Sep 1, 2024

    @ciekawy

    Interestingly I am facing yarn SIGSEGV on Docker Desktom 4.33... Do I need to check specific versions/settings? I have the VirtioFS enabled

    UPDATE using simply NODE_OPTIONS="--max-old-space-size=4096" did help in my case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions