Skip to content

wac_types::Package::from_bytes fails with "should have owner" after #74 #81

@juntyr

Description

@juntyr

With https://github.com/bytecodealliance/wac/tree/66c067254ecf9ad862a195e49d3465b656f4e517, I was able to transition my project from wac-parser to wac-graph and run my component composition successfully.

However, with #74 (tested on https://github.com/bytecodealliance/wac/tree/d3f6be29f2629d866be4b1e476b373d7feaf77b5), wac_types::Package::from_bytes fails with the following panic:

thread 'main' panicked at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:770:26:
should have owner
stack backtrace:
   0: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:196:5
   3: core::panicking::panic_str
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:171:5
   4: core::option::expect_failed
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/option.rs:1988:5
   5: core::option::Option<T>::expect
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/option.rs:894:21
   6: wac_types::package::TypeConverter::resource
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:768:34
   7: wac_types::package::TypeConverter::ty
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:502:73
   8: wac_types::package::TypeConverter::entity
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:562:35
   9: wac_types::package::TypeConverter::component_instance_type
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:537:26
  10: wac_types::package::TypeConverter::entity
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:568:17
  11: wac_types::package::TypeConverter::export
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:415:9
  12: wac_types::package::Package::from_bytes::{{closure}}
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:239:65
  13: core::iter::adapters::map::map_try_fold::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/map.rs:96:28
  14: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:2462:21
  15: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/map.rs:122:9
  16: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/mod.rs:201:9
  17: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/mod.rs:378:13
  18: core::iter::traits::iterator::Iterator::for_each
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:858:9
  19: <indexmap::map::IndexMap<K,V,S> as core::iter::traits::collect::Extend<(K,V)>>::extend
             at /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/indexmap-2.2.6/src/map.rs:1364:9
  20: <indexmap::map::IndexMap<K,V,S> as core::iter::traits::collect::FromIterator<(K,V)>>::from_iter
             at /workspace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/indexmap-2.2.6/src/map.rs:1312:9
  21: core::iter::traits::iterator::Iterator::collect
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:2054:9
  22: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/result.rs:1930:51
  23: core::iter::adapters::try_process
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/adapters/mod.rs:170:17
  24: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/result.rs:1930:9
  25: core::iter::traits::iterator::Iterator::collect
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/iter/traits/iterator.rs:2054:9
  26: wac_types::package::Package::from_bytes
             at /workspace/.cargo/git/checkouts/wac-6a66731467f4795b/d3f6be2/crates/wac-types/src/package.rs:237:75
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I have attached one of my components which now fails to load:
virtual_wasi_cli.component.wasm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions