supermemory icon indicating copy to clipboard operation
supermemory copied to clipboard

Self-hosted server crashes with SIGILL on x86-64 CPUs without AVX2 (linux-x64 built with bun-linux-x64 instead of -baseline)

Open zk1ppy opened this issue 1 month ago • 2 comments

Bug report

Environment

  • OS: Linux x86-64, Debian-based Kubernetes (k3s) node
  • CPU: Intel Xeon E3-1245 v2 (Ivy Bridge: AVX, no AVX2)
  • Supermemory: self-hosted server docker.io/supermemory/supermemory:0.0.9 (amd64), also reproduced with 0.0.8 and 0.0.7
  • Runtime embedded in the binary: Bun v1.3.4 (5eb2145b) Linux x64

Steps to reproduce

  1. On an x86-64 CPU without AVX2, run docker run --rm supermemory/supermemory:0.0.9, or run the standalone supermemory-server-linux-x64 asset directly.
  2. Alternatively, on any x86-64 machine, run qemu-x86_64 -cpu IvyBridge ./supermemory-server-linux-x64.

Expected behavior

The server starts and answers /v3/health.

Actual behavior

The process dies within seconds, before opening its port. The standalone binary exits with code 132, and the container goes into CrashLoopBackOff.

Error messages

Illegal instruction
traps: supermemory-ser[...] trap invalid opcode ip:4084550 ...

The disassembly at 0x4084550 shows vinserti128 $0x1,%xmm1,%ymm0,%ymm0, which is an AVX2 instruction.

Analysis

  • The binary is a bun build --compile executable. Its first 104,292,808 bytes are byte-identical to the official bun-linux-x64 v1.3.4 runtime, which is the "modern" build and requires AVX2. The faulting address is inside the Bun runtime's .text.
  • The other native parts look fine: embeddings and PGlite run through WASM, and rivet-engine is a generic x86_64-unknown-linux-musl build.
  • For a local test only, without redistributing anything, I swapped in the official bun-linux-x64-baseline v1.3.4 runtime and kept the appended JS payload unchanged. Under qemu-x86_64 -cpu IvyBridge, that binary reports 0.0.9, starts, ingests a document through /v3/documents (status done, with local embeddings) and answers /v4/search with 200.

Feature request

Problem statement

The self-hosted server cannot run on x86-64 CPUs without AVX2, which are still common in homelabs and on older dedicated servers.

Proposed solution

Publish a baseline build: a supermemory-server-linux-x64-baseline release asset built with bun build --compile --target=bun-linux-x64-baseline, and a matching image tag such as 0.0.9-baseline. Optionally, install.sh could check /proc/cpuinfo for avx2 and choose that asset when it is missing.

Alternatives considered

  • Build x64 with the baseline target by default. Bun's baseline build still does runtime SIMD dispatch, so the cost is usually small.
  • Run the binary under QEMU user-mode emulation. It works, but it costs a lot of CPU and RAM.
  • Patch the runtime locally, as described above. Is that acceptable under the lite license as a stopgap?

zk1ppy avatar Oct 31 '26 14:10 zk1ppy

ENG-1331

linear-code[bot] avatar Oct 31 '26 14:10 linear-code[bot]

If this isn't already being handled internally, I can send a PR that adds a supermemory-server-linux-x64-baseline asset built with bun build --compile --target=bun-linux-x64-baseline, plus an avx2 check in install.sh that picks it when the CPU lacks AVX2. I'd verify it the way the report does, under qemu-x86_64 -cpu IvyBridge against /v3/health.

sharmis-tp avatar Nov 04 '26 11:11 sharmis-tp