Stream: git-wasmtime

Topic: wasmtime / issue #9685 Bug in loading Extern Function nam...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 10:29):

AlaaAlHallaq opened issue #9685:

https://github.com/bytecodealliance/wasmtime/blob/2b3fe80b65c4943428ec1d587bf35740cd977401/cranelift/codegen/src/ir/extname.rs#L199

when I tried to load mpfrp wasm file compiled and used by nodejs package gmp-wasm:
the following panic stack trace occure:

thread '<unnamed>' panicked at /Users/alaahallaq/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.110.2/src/ir/extname.rs:199:58:
index out of bounds: the len is 0 but the index is 191
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: <usize as core::slice::index::SliceIndex<[T]>>::index
   4: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
   5: <cranelift_entity::primary::PrimaryMap<K,V> as core::ops::index::Index<K>>::index
   6: <cranelift_codegen::ir::extname::DisplayableExternalName as core::fmt::Display>::fmt
   7: core::fmt::write
   8: core::fmt::Formatter::write_fmt
   9: <cranelift_codegen::ir::extfunc::DisplayableExtFuncData as core::fmt::Display>::fmt
  10: <&T as core::fmt::Display>::fmt
  11: core::fmt::write
  12: <core::fmt::Formatter as core::fmt::Write>::write_fmt
  13: cranelift_codegen::write::FuncWriter::super_entity_definition
  14: cranelift_codegen::write::FuncWriter::write_entity_definition
  15: cranelift_codegen::write::FuncWriter::super_preamble
  16: cranelift_codegen::write::FuncWriter::write_preamble
  17: cranelift_codegen::write::decorate_function
  18: cranelift_codegen::write::write_function
  19: <cranelift_codegen::ir::function::DisplayFunction as core::fmt::Display>::fmt
  20: core::fmt::write
  21: <&T as core::fmt::Display>::fmt
  22: core::fmt::write
  23: alloc::fmt::format::format_inner
  24: alloc::fmt::format::{{closure}}
  25: core::option::Option<T>::map_or_else
  26: alloc::fmt::format
  27: <oslog::logger::OsLogger as log::Log>::log
  28: log::__private_api::log_impl
  29: log::__private_api::log
  30: cranelift_codegen::context::Context::optimize
  31: cranelift_codegen::context::Context::compile_stencil
  32: cranelift_codegen::context::Context::compile
  33: cranelift_codegen::context::Context::compile_and_emit
  34: <wasmer_compiler_cranelift::compiler::CraneliftCompiler as wasmer_compiler::compiler::Compiler>::compile_module::{{closure}}
  35: core::ops::function::impls::<impl core::ops::function::Fn<A> for &F>::call
  36: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter::with::{{closure}}
  37: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  38: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  39: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  40: <core::iter::adapters::take_while::TakeWhile<I,P> as core::iter::traits::iterator::Iterator>::next
  41: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  42: alloc::vec::Vec<T,A>::extend_desugared
  43: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
  44: <alloc::vec::Vec<T,A> as core::iter::traits::collect::Extend<T>>::extend
  45: <rayon::iter::extend::ListVecFolder<T> as rayon::iter::plumbing::Folder<T>>::consume_iter
  46: <rayon::iter::while_some::WhileSomeFolder<C> as rayon::iter::plumbing::Folder<core::option::Option<T>>>::consume_iter
  47: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
  48: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
  49: rayon::iter::plumbing::Producer::fold_with
  50: rayon::iter::plumbing::bridge_producer_consumer::helper
  51: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  52: rayon_core::join::join_context::call_b::{{closure}}
  53: rayon_core::job::JobResult<T>::call::{{closure}}
  54: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  55: std::panicking::try::do_call
  56: ___rust_try
  57: std::panic::catch_unwind
  58: rayon_core::unwind::halt_unwinding
  59: rayon_core::job::JobResult<T>::call
  60: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  61: rayon_core::job::JobRef::execute
  62: rayon_core::registry::WorkerThread::execute
  63: rayon_core::registry::WorkerThread::wait_until_cold
  64: rayon_core::registry::WorkerThread::wait_until
  65: rayon_core::join::join_recover_from_panic
  66: rayon_core::join::join_context::{{closure}}
  67: rayon_core::registry::in_worker
  68: rayon_core::join::join_context
  69: rayon::iter::plumbing::bridge_producer_consumer::helper
  70: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  71: rayon_core::join::join_context::call_b::{{closure}}
  72: rayon_core::job::JobResult<T>::call::{{closure}}
  73: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  74: std::panicking::try::do_call
  75: ___rust_try
  76: std::panic::catch_unwind
  77: rayon_core::unwind::halt_unwinding
  78: rayon_core::job::JobResult<T>::call
  79: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  80: rayon_core::job::JobRef::execute
  81: rayon_core::registry::WorkerThread::execute
  82: rayon_core::registry::WorkerThread::wait_until_cold
  83: rayon_core::registry::WorkerThread::wait_until
  84: rayon_core::join::join_recover_from_panic
  85: rayon_core::join::join_context::{{closure}}
  86: rayon_core::registry::in_worker
  87: rayon_core::join::join_context
  88: rayon::iter::plumbing::bridge_producer_consumer::helper
  89: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  90: rayon_core::join::join_context::call_a::{{closure}}

I noticed that the issue can be bypassed if I lowered the log level of crate log from Debug to Warn.

I propose to double check the user_named_funcs length

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 15:52):

alexcrichton commented on issue #9685:

Could you inclue the steps necessary to reproduce this issue? For example can you link to or upload the wasm file you're using? What log level is needed? What command is used to trigger this? (etc)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 16:14):

bjorn3 commented on issue #9685:

It looks like Wasmer generates a UserExternalNameRef out of thin air without registering it with func.params(): https://github.com/wasmerio/wasmer/blob/f5c417258dd54316c3983b47cbdc754aea32f2ff/lib/compiler-cranelift/src/func_environ.rs#L32, https://github.com/wasmerio/wasmer/blob/f5c417258dd54316c3983b47cbdc754aea32f2ff/lib/compiler-cranelift/src/func_environ.rs#L1261-L1268 rather than using func.declare_imported_user_function(). For comparison this is what Wasmtime does: https://github.com/bytecodealliance/wasmtime/blob/2b3fe80b65c4943428ec1d587bf35740cd977401/crates/cranelift/src/compiler.rs#L1022-L1034

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 17:17):

AlaaAlHallaq commented on issue #9685:

@bjorn3 I think you are right !
@alexcrichton : I will attach the file & the direct sample code of wasmer should trigger this bug using version 5.0.0-5.0.2, but a logger (with debug or trace level) should be configured to trigger this issue:

frp.wasm.zip

Sample code to trigger the issue:

use std::{fs::File, io::Read};

use wasmer::*;
mod encoded;
use log::{Metadata, Record};

struct SimpleLogger;
use log::{LevelFilter, SetLoggerError};

fn main() {
    setup_logger().unwrap();
    let (mut store, instance) = {
        let compiler = Cranelift::new();
        let mut store = Store::new(compiler);

        let data = {
            let mut file = File::open("PATH/to/frp.wasm").unwrap();
            let mut vec = Vec::new();
            file.read_to_end(&mut vec).unwrap();
            vec
        };
        // this is where the panic is triggered, while compiling the wasm file.
        let module = wasmer::Module::from_binary(&store, data.as_slice()).unwrap();

        let mut imports = Imports::new();
        define_imports(&mut store, &mut imports);
        let instance = Instance::new(&mut store, &module, &mut imports).unwrap();
        (store, instance)
    };
    let initialize = instance.exports.get_function("_initialize").unwrap();
    initialize.call(&mut store, &[]).unwrap();

    let mpfr_t = instance.exports.get_function("r_t").unwrap();
    let v = mpfr_t.call(&mut store, &[]).unwrap();
    let vr = v.as_ref();
    println!("==> init is :{:?}", vr);
}

static LOGGER: SimpleLogger = SimpleLogger;

pub fn setup_logger() -> Result<(), SetLoggerError> {
    log::set_logger(&LOGGER).map(|()| log::set_max_level(LevelFilter::Trace))
}
impl log::Log for SimpleLogger {
    fn enabled(&self, metadata: &Metadata) -> bool {
        //metadata.level() <= Level::Info
        true
    }
    fn log(&self, record: &Record) {
        if self.enabled(record.metadata()) {
            println!("{} - {}", record.level(), record.args());
        }
    }
    fn flush(&self) {}
}

fn define_imports(store: &mut Store, imports: &mut Imports) {
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_seek".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I64, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_write".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I32, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_close".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![Type::I32]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "proc_exit".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "env".to_string(),
        "emscripten_notify_memory_growth".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
}
fn define_function<F, T>(
    ns: String,
    name: String,
    imports: &mut Imports,
    store: &mut Store,
    data: T,
    ty: FunctionType,
    f: F,
) where
    F: Fn(FunctionEnvMut<T>, &[Value]) -> Result<Vec<Value>, RuntimeError> + 'static + Send + Sync,
    T: 'static + Send + Sync,
{
    let env = FunctionEnv::new(store, data);
    imports.define(
        ns.as_str(),
        name.as_str(),
        Function::new_with_env(store, &env, ty, f),
    );
}

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 17:17):

AlaaAlHallaq edited a comment on issue #9685:

@bjorn3 I think you are right !
@alexcrichton : I will attach the file & the direct sample code of wasmer should trigger this bug using version 5.0.0-5.0.2, but a logger (with debug or trace level) should be configured to trigger this issue:

frp.wasm.zip

Sample code to trigger the issue:

use std::{fs::File, io::Read};

use wasmer::*;
mod encoded;
use log::{Metadata, Record};

struct SimpleLogger;
use log::{LevelFilter, SetLoggerError};

fn main() {
    setup_logger().unwrap();
    let (mut store, instance) = {
        let compiler = Cranelift::new();
        let mut store = Store::new(compiler);

        let data = {
            let mut file = File::open("PATH/to/frp.wasm").unwrap();
            let mut vec = Vec::new();
            file.read_to_end(&mut vec).unwrap();
            vec
        };
        // this is where the panic is triggered, while compiling the wasm file.
        let module = wasmer::Module::from_binary(&store, data.as_slice()).unwrap();

        let mut imports = Imports::new();
        define_imports(&mut store, &mut imports);
        let instance = Instance::new(&mut store, &module, &mut imports).unwrap();
        (store, instance)
    };
    let initialize = instance.exports.get_function("_initialize").unwrap();
    initialize.call(&mut store, &[]).unwrap();

    let mpfr_t = instance.exports.get_function("r_t").unwrap();
    let v = mpfr_t.call(&mut store, &[]).unwrap();
    let vr = v.as_ref();
    println!("==> init is :{:?}", vr);
}

static LOGGER: SimpleLogger = SimpleLogger;

pub fn setup_logger() -> Result<(), SetLoggerError> {
    log::set_logger(&LOGGER).map(|()| log::set_max_level(LevelFilter::Trace))
}
impl log::Log for SimpleLogger {
    fn enabled(&self, metadata: &Metadata) -> bool {
        //metadata.level() <= Level::Info
        true
    }
    fn log(&self, record: &Record) {
        if self.enabled(record.metadata()) {
            println!("{} - {}", record.level(), record.args());
        }
    }
    fn flush(&self) {}
}

fn define_imports(store: &mut Store, imports: &mut Imports) {
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_seek".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I64, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_write".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I32, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_close".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![Type::I32]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "proc_exit".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "env".to_string(),
        "emscripten_notify_memory_growth".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
}
fn define_function<F, T>(
    ns: String,
    name: String,
    imports: &mut Imports,
    store: &mut Store,
    data: T,
    ty: FunctionType,
    f: F,
) where
    F: Fn(FunctionEnvMut<T>, &[Value]) -> Result<Vec<Value>, RuntimeError> + 'static + Send + Sync,
    T: 'static + Send + Sync,
{
    let env = FunctionEnv::new(store, data);
    imports.define(
        ns.as_str(),
        name.as_str(),
        Function::new_with_env(store, &env, ty, f),
    );
}

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 17:18):

AlaaAlHallaq edited a comment on issue #9685:

@bjorn3 I think you are right !
@alexcrichton : I will attach the file & the direct sample code of wasmer should trigger this bug using version 5.0.0-5.0.2, but a logger (with debug or trace level) should be configured to trigger this issue:

frp.wasm.zip

Sample code to trigger the issue:

use std::{fs::File, io::Read};

use wasmer::*;
use log::{Metadata, Record};

struct SimpleLogger;
use log::{LevelFilter, SetLoggerError};

fn main() {
    setup_logger().unwrap();
    let (mut store, instance) = {
        let compiler = Cranelift::new();
        let mut store = Store::new(compiler);

        let data = {
            let mut file = File::open("PATH/to/frp.wasm").unwrap();
            let mut vec = Vec::new();
            file.read_to_end(&mut vec).unwrap();
            vec
        };
        // this is where the panic is triggered, while compiling the wasm file.
        let module = wasmer::Module::from_binary(&store, data.as_slice()).unwrap();

        let mut imports = Imports::new();
        define_imports(&mut store, &mut imports);
        let instance = Instance::new(&mut store, &module, &mut imports).unwrap();
        (store, instance)
    };
    let initialize = instance.exports.get_function("_initialize").unwrap();
    initialize.call(&mut store, &[]).unwrap();

    let mpfr_t = instance.exports.get_function("r_t").unwrap();
    let v = mpfr_t.call(&mut store, &[]).unwrap();
    let vr = v.as_ref();
    println!("==> init is :{:?}", vr);
}

static LOGGER: SimpleLogger = SimpleLogger;

pub fn setup_logger() -> Result<(), SetLoggerError> {
    log::set_logger(&LOGGER).map(|()| log::set_max_level(LevelFilter::Trace))
}
impl log::Log for SimpleLogger {
    fn enabled(&self, metadata: &Metadata) -> bool {
        //metadata.level() <= Level::Info
        true
    }
    fn log(&self, record: &Record) {
        if self.enabled(record.metadata()) {
            println!("{} - {}", record.level(), record.args());
        }
    }
    fn flush(&self) {}
}

fn define_imports(store: &mut Store, imports: &mut Imports) {
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_seek".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I64, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_write".to_string(),
        imports,
        store,
        (),
        FunctionType::new(
            vec![Type::I32, Type::I32, Type::I32, Type::I32],
            vec![Type::I32],
        ),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );

    define_function(
        "wasi_snapshot_preview1".to_string(),
        "fd_close".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![Type::I32]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "wasi_snapshot_preview1".to_string(),
        "proc_exit".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
    define_function(
        "env".to_string(),
        "emscripten_notify_memory_growth".to_string(),
        imports,
        store,
        (),
        FunctionType::new(vec![Type::I32], vec![]),
        |env, args| Result::Ok(vec![Value::I32(0)]),
    );
}
fn define_function<F, T>(
    ns: String,
    name: String,
    imports: &mut Imports,
    store: &mut Store,
    data: T,
    ty: FunctionType,
    f: F,
) where
    F: Fn(FunctionEnvMut<T>, &[Value]) -> Result<Vec<Value>, RuntimeError> + 'static + Send + Sync,
    T: 'static + Send + Sync,
{
    let env = FunctionEnv::new(store, data);
    imports.define(
        ns.as_str(),
        name.as_str(),
        Function::new_with_env(store, &env, ty, f),
    );
}

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 18:51):

alexcrichton commented on issue #9685:

Ah if you're using wasmer we don't provide support for that here. Can you raise the issue with them instead? It may be a problem with how they're integrating with Cranelift like @bjorn3 mentioned

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 19:12):

AlaaAlHallaq commented on issue #9685:

Ok thanks will pass what @bjorn3 wrote there.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 19:13):

AlaaAlHallaq closed issue #9685:

https://github.com/bytecodealliance/wasmtime/blob/2b3fe80b65c4943428ec1d587bf35740cd977401/cranelift/codegen/src/ir/extname.rs#L199

when I tried to load mpfrp wasm file compiled and used by nodejs package gmp-wasm:
the following panic stack trace occure:

thread '<unnamed>' panicked at /Users/alaahallaq/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.110.2/src/ir/extname.rs:199:58:
index out of bounds: the len is 0 but the index is 191
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: <usize as core::slice::index::SliceIndex<[T]>>::index
   4: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
   5: <cranelift_entity::primary::PrimaryMap<K,V> as core::ops::index::Index<K>>::index
   6: <cranelift_codegen::ir::extname::DisplayableExternalName as core::fmt::Display>::fmt
   7: core::fmt::write
   8: core::fmt::Formatter::write_fmt
   9: <cranelift_codegen::ir::extfunc::DisplayableExtFuncData as core::fmt::Display>::fmt
  10: <&T as core::fmt::Display>::fmt
  11: core::fmt::write
  12: <core::fmt::Formatter as core::fmt::Write>::write_fmt
  13: cranelift_codegen::write::FuncWriter::super_entity_definition
  14: cranelift_codegen::write::FuncWriter::write_entity_definition
  15: cranelift_codegen::write::FuncWriter::super_preamble
  16: cranelift_codegen::write::FuncWriter::write_preamble
  17: cranelift_codegen::write::decorate_function
  18: cranelift_codegen::write::write_function
  19: <cranelift_codegen::ir::function::DisplayFunction as core::fmt::Display>::fmt
  20: core::fmt::write
  21: <&T as core::fmt::Display>::fmt
  22: core::fmt::write
  23: alloc::fmt::format::format_inner
  24: alloc::fmt::format::{{closure}}
  25: core::option::Option<T>::map_or_else
  26: alloc::fmt::format
  27: <oslog::logger::OsLogger as log::Log>::log
  28: log::__private_api::log_impl
  29: log::__private_api::log
  30: cranelift_codegen::context::Context::optimize
  31: cranelift_codegen::context::Context::compile_stencil
  32: cranelift_codegen::context::Context::compile
  33: cranelift_codegen::context::Context::compile_and_emit
  34: <wasmer_compiler_cranelift::compiler::CraneliftCompiler as wasmer_compiler::compiler::Compiler>::compile_module::{{closure}}
  35: core::ops::function::impls::<impl core::ops::function::Fn<A> for &F>::call
  36: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter::with::{{closure}}
  37: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  38: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  39: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  40: <core::iter::adapters::take_while::TakeWhile<I,P> as core::iter::traits::iterator::Iterator>::next
  41: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  42: alloc::vec::Vec<T,A>::extend_desugared
  43: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
  44: <alloc::vec::Vec<T,A> as core::iter::traits::collect::Extend<T>>::extend
  45: <rayon::iter::extend::ListVecFolder<T> as rayon::iter::plumbing::Folder<T>>::consume_iter
  46: <rayon::iter::while_some::WhileSomeFolder<C> as rayon::iter::plumbing::Folder<core::option::Option<T>>>::consume_iter
  47: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
  48: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
  49: rayon::iter::plumbing::Producer::fold_with
  50: rayon::iter::plumbing::bridge_producer_consumer::helper
  51: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  52: rayon_core::join::join_context::call_b::{{closure}}
  53: rayon_core::job::JobResult<T>::call::{{closure}}
  54: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  55: std::panicking::try::do_call
  56: ___rust_try
  57: std::panic::catch_unwind
  58: rayon_core::unwind::halt_unwinding
  59: rayon_core::job::JobResult<T>::call
  60: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  61: rayon_core::job::JobRef::execute
  62: rayon_core::registry::WorkerThread::execute
  63: rayon_core::registry::WorkerThread::wait_until_cold
  64: rayon_core::registry::WorkerThread::wait_until
  65: rayon_core::join::join_recover_from_panic
  66: rayon_core::join::join_context::{{closure}}
  67: rayon_core::registry::in_worker
  68: rayon_core::join::join_context
  69: rayon::iter::plumbing::bridge_producer_consumer::helper
  70: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  71: rayon_core::join::join_context::call_b::{{closure}}
  72: rayon_core::job::JobResult<T>::call::{{closure}}
  73: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  74: std::panicking::try::do_call
  75: ___rust_try
  76: std::panic::catch_unwind
  77: rayon_core::unwind::halt_unwinding
  78: rayon_core::job::JobResult<T>::call
  79: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  80: rayon_core::job::JobRef::execute
  81: rayon_core::registry::WorkerThread::execute
  82: rayon_core::registry::WorkerThread::wait_until_cold
  83: rayon_core::registry::WorkerThread::wait_until
  84: rayon_core::join::join_recover_from_panic
  85: rayon_core::join::join_context::{{closure}}
  86: rayon_core::registry::in_worker
  87: rayon_core::join::join_context
  88: rayon::iter::plumbing::bridge_producer_consumer::helper
  89: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
  90: rayon_core::join::join_context::call_a::{{closure}}

I noticed that the issue can be bypassed if I lowered the log level of crate log from Debug to Warn.

I propose to double check the user_named_funcs length


Last updated: Dec 23 2024 at 13:07 UTC