bytecodealliance / bytecodealliance/componentize-py

Composed component from `wac plug` throws `NotImplementedError`

Đang mở
#185 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
277
Fork
51
Merge trung bình
12 giờ 10 phút
Pull request đã merge (30 ngày)
10

Mô tả

Hello,

I am experimenting with WASM components. I have two packages, A and B.

```wit
package example:a;

interface %type {
record blob {
x: f64,
}
}

interface %interface {
use %type.{blob};

f-a: func(x: f64) -> blob;
}

world %world {
export %type;
export %interface;
}
```

```py
from a.interface.wit_world.exports import Interface as Base
from a.interface.wit_world.exports.type import Blob

class Interface(Base):
def f_a(self, x: float):
return Blob(x=x * 5)
```

```wit
package example:b;

interface %interface {
use example:a/%type.{blob};

f-b: func(x: f64) -> blob;
}

world %world {
import example:a/%interface;

export %interface;
}
```

```py
from b.interface.wit_world.exports import Interface as Base
from b.interface.wit_world.imports.interface import f_a

class Interface(Base):
def f_b(self, x: float):
return f_a(f_a(x).x)
```

If I do `componentize-py componentize` on A, I can run this on the output successfully

```
wasmtime run --invoke 'f-a(3)' a.wasm
```

However, when i do

```
wac plug --plug a.wasm b.wasm --output composed.wasm
```

```
wasmtime run --invoke 'f-b(3)' composed.wasm
```

gives me

```
Traceback (most recent call last):
File "/1/b/implementation/__init__.py", line 11, in f_b1
File "/1/b/interface/wit_world/imports/interface.py", line 15, in f_a
NotImplementedError

thread '' (1) panicked at runtime/src/lib.rs:1290:25:
Python function threw an unexpected exception
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: failed to run main module `composed.wasm`

Caused by:
0: error while executing at wasm backtrace:
0: 0x4b05657 - libc.so!abort
1: 0x2695395 - !
2: 0x31fbc00 - libcomponentize_py_runtime_sync.so!std::sys::pal::wasip1::helpers::abort_internal
3: 0x31fdce0 - libcomponentize_py_runtime_sync.so!std::process::abort
4: 0x31eeaf7 - libcomponentize_py_runtime_sync.so!__rustc::__rust_abort
5: 0x318476f - libcomponentize_py_runtime_sync.so!__rustc::__rust_start_panic
6: 0x31ff807 - libcomponentize_py_runtime_sync.so!__rustc::rust_panic
7: 0x3200983 - libcomponentize_py_runtime_sync.so!std::panicking::panic_with_hook
8: 0x32038fc - libcomponentize_py_runtime_sync.so!std::panicking::panic_handler::{closure#0}
9: 0x320388f - libcomponentize_py_runtime_sync.so!std::sys::backtrace::__rust_end_short_backtrace::
10: 0x31ff8de - libcomponentize_py_runtime_sync.so!__rustc::rust_begin_unwind
11: 0x32453ff - libcomponentize_py_runtime_sync.so!core::panicking::panic_fmt
12: 0x31748f7 - libcomponentize_py_runtime_sync.so!wit_dylib_export_call
13: 0x4cd1934 - !example:b/%interface#f-b
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
1: wasm trap: wasm `unreachable` instruction executed
```

Why doesn't the implementation of `f-a` end up in the composed component?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện vấn đề bằng cách chạy `componentize-py componentize` cho A, sau đó `wac plug --plug a.wasm b.wasm`, và gọi `f-b(3)` bằng wasmtime. Kiểm tra `b/interface/wit_world/imports/interface.py` tại `f_a` và các triển khai Python được hiển thị trong báo cáo. Được xem là hoàn tất khi component được kết hợp thực thi `f-b(3)` mà không có `NotImplementedError` hoặc runtime panic.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python, wasm
Lĩnh vực
devtools, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.