Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

musl-c-api Version of Library Not Working Starting from Version 27.0.0 on Alpine Linux Distribution

Aperta
#330 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
csharp, linux, rust

Direzione di ricerca

Riproduci il malfunzionamento con il container Alpine .NET 8 e confronta gli archivi C-API x86_64-musl delle versioni 26.0.1 e 27.0.0. Inizia da crates/c-api/src/types/memory.rs:89 e dal Program.cs dell’esempio dotnet-opa-wasm, quindi verifica l’entry point mancante wasmtime_config_static_memory_maximum_size_set. Il lavoro è completato quando la libreria musl esegue l’esempio senza il panic relativo alla memoria condivisa e il comportamento rilevante è coperto da un test di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

TL;DR
Starting with Wasmtime version 27.0.0, the musl-c-api build fails on Alpine Linux, causing a memory panic error. The last known working version is 26.0.1. I’m using Opa.Wasm, which depends on wasmtime-dotnet.

Image

Steps to Reproduce
Install Wasmtime using Alpine's edge testing repository:

FROM  mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
RUN apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ libwasmtime #not working V30

Invoke Wasmtime from your code: For instance, use the dotnet-opa-wasm library sample (see dotnet-opa-wasm sample).

Encounter the error:

thread '<unnamed>' panicked at crates/c-api/src/types/memory.rs:89:14:
called `Result::unwrap()` on an `Err` value: shared memories must have a maximum size
Test Case

The musl-c-api build of the Wasmtime library, when deployed on Alpine Linux distributions, begins to fail starting with version 27.0.0. The last version that worked correctly is 26.0.1. This issue likely stems from a breaking change in newer versions that the musl environment on Alpine cannot handle.

Key Observations:

Alpine Linux vs. Debian:

  • Alpine Linux: Requires a statically linked musl version of the library, which fails from version 27.0.0 onward.

  • Debian-based distributions: Work normally with the latest version because they use the dynamically linked version of Wasmtime.

Memory Panic Error:

  • The application crashes with an error indicating that "shared memories must have a maximum size" due to an unhandled Err value when unwrap() is called.

Configuration Settings Failure:

  • Attempts to set memory limits via code (e.g., using the opa-wasm library) also fail. For example, invoking wasmtime_config_static_memory_maximum_size_set results in:

System.EntryPointNotFoundException: Unable to find an entry point named 'wasmtime_config_static_memory_maximum_size_set' in shared library 'wasmtime'.

Edge Repository Issue:

  • The version available from Alpine’s edge testing repository (e.g., version 30) exhibits this issue, reinforcing the need to revert to a previously working version.
Expected Results

The application should run without crashing, with Wasmtime functioning as expected.

Actual Results

Error Stack Trace (Version 29.0.0)

09:52:55:422	Loaded '/app/bin/Debug/net8.0/Opa.Wasm.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
09:52:55:673	thread '<unnamed>' panicked at crates/c-api/src/types/memory.rs:89:14:
09:52:55:673	called `Result::unwrap()` on an `Err` value: shared memories must have a maximum size
09:52:55:673	
09:52:55:673	Stack backtrace:
09:52:55:673	   0: anyhow::error::<impl anyhow::Error>::msg
09:52:55:673	stack backtrace:
09:52:55:673	   0:     0x7f494e9a5a0a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4e2ed00da9626c89
09:52:55:673	   1:     0x7f494e9cac33 - core::fmt::write::h1e2817ad6effb3a8
09:52:55:673	   2:     0x7f494e9a2233 - std::io::Write::write_fmt::h2248a88e59fb6993
09:52:55:673	   3:     0x7f494e9a5852 - std::sys::backtrace::BacktraceLock::print::he72565f9e0b2846f
09:52:55:673	   4:     0x7f494e9a6887 - std::panicking::default_hook::{{closure}}::hd88bc1072bff8016
09:52:55:673	   5:     0x7f494e9a66cd - std::panicking::default_hook::h2975aaf8fe1bdbb2
09:52:55:673	   6:     0x7f494e9a6e57 - std::panicking::rust_panic_with_hook::h54f358af0528b0ac
09:52:55:673	   7:     0x7f494e9a6cea - std::panicking::begin_panic_handler::{{closure}}::h8022c92830c406a8
09:52:55:673	   8:     0x7f494e9a5ee9 - std::sys::backtrace::__rust_end_short_backtrace::h4b072f3484fb4e42
09:52:55:673	   9:     0x7f494e9a697c - rust_begin_unwind
09:52:55:673	  10:     0x7f494e0622f0 - core::panicking::panic_fmt::h8143c7df49e27964
09:52:55:673	  11:     0x7f494e062736 - core::result::unwrap_failed::h77d9a525433959c1
09:52:55:673	  12:     0x7f494e090d6e - wasmtime_memorytype_new
09:52:55:673	  13:     0x7f89f181d699 - <unknown>
09:52:56:267	The program 'dotnet' has exited with code 0 (0x0).

Versions and Environment
  • Any newer musl-c-api newer from 26.0.0
  • mcr.microsoft.com/dotnet/aspnet:8.0-alpine
Extra Info
# RUN apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ libwasmtime  # Not working: V30
# ARG WASMTIME_VERSION=30.0.1  
# ARG WASMTIME_VERSION=27.0.0  
ARG WASMTIME_VERSION=26.0.1  # Last working version
RUN wget https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-x86_64-musl-c-api.tar.xz
RUN tar -xJvf wasmtime-v${WASMTIME_VERSION}-x86_64-musl-c-api.tar.xz -C /usr
RUN cp -r /usr/wasmtime-v${WASMTIME_VERSION}-x86_64-musl-c-api/include/. /usr/include
RUN cp -r /usr/wasmtime-v${WASMTIME_VERSION}-x86_64-musl-c-api/lib/. /usr/lib
Lingua principale
C#
Stelle
517
Fork
69
Merge medio
6h 1m
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/wasmtime-dotnet

Tutte le issue di bytecodealliance/wasmtime-dotnet

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.