dragonflydb / dragonfly

A modern replacement for Redis and Memcached
https://www.dragonflydb.io/
Other
25.41k stars 918 forks source link

Running DragonFly on Mac M1 - getting error #3126

Closed wernermorgenstern closed 3 months ago

wernermorgenstern commented 3 months ago

Describe the bug When I try to run DragonFly locally on Mac M1, and just running the tests for BullMQ, I get this error dfly_main.cc:564] An attempt to execute an instruction failed.The root cause might be an old hardware. Exiting... And DragonFly crashes

To Reproduce Steps to reproduce the behavior:

  1. Run DragonFly with Docker docker run --privileged -p 6379:6379 --ulimit memlock=-1 docker.dragonflydb.io/dragonflydb/dragonfly
  2. Run tests for BullMQ
  3. Logs
    W20240604 13:38:09.497195     1 dfly_main.cc:685] SWAP is enabled. Consider disabling it when running Dragonfly.
    I20240604 13:38:09.497254     1 dfly_main.cc:690] maxmemory has not been specified. Deciding myself....
    I20240604 13:38:09.497267     1 dfly_main.cc:699] Found 4.90GiB available memory. Setting maxmemory to 3.92GiB
    W20240604 13:38:09.499913     1 dfly_main.cc:366] iouring API is not supported. switching to epoll.
    I20240604 13:38:09.589691     1 proactor_pool.cc:147] Running 5 io threads
    I20240604 13:38:09.650450     1 server_family.cc:721] Host OS: Linux 6.6.26-linuxkit x86_64 with 5 threads
    I20240604 13:38:09.655265     1 snapshot_storage.cc:108] Load snapshot: Searching for snapshot in directory: "/data"
    W20240604 13:38:09.657377     1 server_family.cc:814] Load snapshot: No snapshot found
    I20240604 13:38:09.675854     9 listener_interface.cc:101] sock[17] AcceptServer - listening on port 6379
    E20240604 13:39:45.672591     8 dfly_main.cc:564] An attempt to execute an instruction failed.The root cause might be an old hardware. Exiting...

Expected behavior Tests for BullMQ should work for DragonFlyDB on Mac M1

Environment (please complete the following information):

Additional context DragonFly works when I use DragonFly Cloud, as well as DragonFly in our EKS Cluster

romange commented 3 months ago

@wernermorgenstern can you please run gcc -march=native -Q --help=target and paste here the output?

wernermorgenstern commented 3 months ago
gcc -march=native -Q --help=target
clang: error: unsupported option '--help=target'
clang: error: no input files
romange commented 3 months ago

ok, then the output of echo | clang -E - -march=native -### ?

wernermorgenstern commented 3 months ago

@romange ,

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" "-cc1" "-triple" "arm64-apple-macosx14.0.0" "-Wundef-prefix=TARGET_OS_" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=non-leaf" "-fno-strict-return" "-ffp-contract=on" "-fno-rounding-math" "-funwind-tables=1" "-fobjc-msgsend-selector-stubs" "-target-sdk-version=14.4" "-fvisibility-inlines-hidden-static-local-var" "-target-cpu" "apple-m1" "-target-feature" "+neon" "-target-feature" "+v8.5a" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-abi" "darwinpcs" "-debugger-tuning=lldb" "-target-linker-version" "1053.12" "-fcoverage-compilation-dir=/Users/wernermorgenstern/Repos/dragonfly" "-resource-dir" "/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-I/usr/local/include" "-internal-isystem" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include" "-internal-isystem" "/Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include" "-internal-externc-isystem" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-internal-externc-isystem" "/Library/Developer/CommandLineTools/usr/include" "-Wno-reorder-init-list" "-Wno-implicit-int-float-conversion" "-Wno-c99-designator" "-Wno-final-dtor-non-final-class" "-Wno-extra-semi-stmt" "-Wno-misleading-indentation" "-Wno-quoted-include-in-framework-header" "-Wno-implicit-fallthrough" "-Wno-enum-enum-conversion" "-Wno-enum-float-conversion" "-Wno-elaborated-enum-base" "-Wno-reserved-identifier" "-Wno-gnu-folding-constant" "-fdebug-compilation-dir=/Users/wernermorgenstern/Repos/dragonfly" "-ferror-limit" "19" "-stack-protector" "1" "-fstack-check" "-mdarwin-stkchk-strong-link" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fmax-type-align=16" "-fcommon" "-fcolor-diagnostics" "-clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation" "-fno-odr-hash-protocols" "-clang-vendor-feature=+enableAggressiveVLAFolding" "-clang-vendor-feature=+revert09abecef7bbf" "-clang-vendor-feature=+thisNoAlignAttr" "-clang-vendor-feature=+thisNoNullAttr" "-mllvm" "-disable-aligned-alloc-awareness=1" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-"
romange commented 3 months ago

@wernermorgenstern it seems you are running emulated x86 on your arm64 mac. It's unnecessary as Dragonfly docker has native arm64 support. Try running without the emulation with --platform linux/arm64

wernermorgenstern commented 3 months ago

When I run this command:

docker run --privileged -p 6379:6379 --platform linux/arm/v8 --ulimit memlock=-1 docker.dragonflydb.io/dragonflydb/dragonfly

I get this error:

Unable to find image 'docker.dragonflydb.io/dragonflydb/dragonfly:latest' locally
latest: Pulling from dragonflydb/dragonfly
docker: no matching manifest for linux/arm/v8 in the manifest list entries.
See 'docker run --help'.
romange commented 3 months ago

My mistake, please try docker run --privileged -p 6379:6379 --platform linux/arm64 --ulimit memlock=-1 docker.dragonflydb.io/dragonflydb/dragonfly