electrs: Bug: Electrs crashes with Illegal instruction when dynamically linked on arm64

Describe the bug Electrs crashes with Illegal instruction when dynamically linked on arm64. This could be a problem in the Debian package but we should check it first.

Electrs version 0.9.2

To Reproduce Steps to reproduce the behavior:

  1. Configure and start electrs compiled with dynamic linking
  2. Wait
  3. See error

Expected behavior Electrs runs

Configuration

electrs.toml
  # RaspiBolt: electrs configuration
  # /mnt/ext/electrs/electrs.conf
  # RPC user / password
  auth = "raspibolt:PASSWORD_[B]"
  # Bitcoin Core settings
  network = "bitcoin"
  daemon_dir= "/mnt/ext/bitcoin"
  daemon_rpc_addr = "127.0.0.1:8332"
  daemon_p2p_addr = "127.0.0.1:8333"
  # Electrs settings
  electrum_rpc_addr = "127.0.0.1:50001"
  db_dir = "/mnt/ext/electrs/db"
  index_lookup_limit = 1000
  # Logging
  verbose = 2
  timestamp = true

Environment variables: none Arguments: --conf <the config file above>

System running electrs

  • Deployment method: manual-RaspiBolt WIP branch
  • OS name and version Debian 11

Electrum client N/A

Additional context https://github.com/raspibolt/raspibolt/pull/777

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Ah, ok, that’s more like it

$ rustc --version
rustc 1.48.0

Cool, happy it worked 😃

Hi @romanz, sorry for lack of response, I’ll check and get back to you asap.

Thanks for all the analysis @romanz . Here is the output of lscpu:

Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               ARM
  Model name:            Cortex-A72
    Model:               3
    Thread(s) per core:  1
    Core(s) per cluster: 4
    Socket(s):           -
    Cluster(s):          1
    Stepping:            r0p3
    CPU max MHz:         1800.0000
    CPU min MHz:         600.0000
    BogoMIPS:            108.00
    Flags:               fp asimd evtstrm crc32 cpuid
Caches (sum of all):     
  L1d:                   128 KiB (4 instances)
  L1i:                   192 KiB (4 instances)
  L2:                    1 MiB (1 instance)
Vulnerabilities:         
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Not affected
  Spec store bypass:     Vulnerable
  Spectre v1:            Mitigation; __user pointer sanitization
  Spectre v2:            Vulnerable
  Srbds:                 Not affected
  Tsx async abort:       Not affected

Also works on https://instances.vantage.sh/aws/ec2/c7g.large (using the same commands as above…)

$ lscpu
Architecture:          aarch64
  CPU op-mode(s):      32-bit, 64-bit
  Byte Order:          Little Endian
CPU(s):                1
  On-line CPU(s) list: 0
Vendor ID:             ARM
  Model:               1
  Thread(s) per core:  1
  Core(s) per socket:  1
  Socket(s):           1
  Stepping:            r1p1
  BogoMIPS:            2100.00
  Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng
Caches (sum of all):   
  L1d:                 64 KiB (1 instance)
  L1i:                 64 KiB (1 instance)
  L2:                  1 MiB (1 instance)
  L3:                  32 MiB (1 instance)
NUMA:                  
  NUMA node(s):        1
  NUMA node0 CPU(s):   0
Vulnerabilities:       
  Itlb multihit:       Not affected
  L1tf:                Not affected
  Mds:                 Not affected
  Meltdown:            Not affected
  Mmio stale data:     Not affected
  Retbleed:            Not affected
  Spec store bypass:   Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:          Mitigation; __user pointer sanitization
  Spectre v2:          Mitigation; CSV2, BHB
  Srbds:               Not affected
  Tsx async abort:     Not affected

It does work on https://gcloud-compute.com/t2a-standard-2.html:

sudo apt update && sudo apt install rustc clang cmake build-essential cargo librocksdb-dev=6.11.4-3

git clone https://github.com/romanz/electrs && cd electrs
ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --locked --release --no-default-features

wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-aarch64-linux-gnu.tar.gz
tar xfvz bitcoin-24.0.1-aarch64-linux-gnu.tar.gz 
./bitcoin-24.0.1/bin/bitcoind -signet &

RUST_LOG=info ./target/release/electrs --network=signet
$ lscpu
Architecture:                    aarch64
CPU op-mode(s):                  64-bit
Byte Order:                      Little Endian
CPU(s):                          1
On-line CPU(s) list:             0
Thread(s) per core:              1
Core(s) per socket:              1
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       ARM
Model:                           1
Model name:                      Neoverse-N1
Stepping:                        r3p1
BogoMIPS:                        50.00
NUMA node0 CPU(s):               0
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; CSV2, BHB
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs

Could you please share rustc --version output?

This is the output I get on the Raspi Debian Bullseye daily image:

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free

$ sudo apt install cargo
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cargo is already the newest version (0.47.0-3+b1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ cargo --version
cargo 1.46.0
* Rust installed from Debian repositories (cargo 1.46.0)

This is a bit unexpected, because IIUC Debian 11 should have Rust 1.48.0, no?