Closed yun-yeo closed 2 years ago
Very interesting. Thanks for the report. The pointer 0x01 indicates an empty vector, which happens when required features is empty. However, I do not yet understand how they can end up in this line because they should be handled by the v.len == cusize(0)
case above.
Do you know what system this happens on (OS and CPU)?
Could you run the same thing with this patch to understand how the UnmanagedVector looks like? https://github.com/CosmWasm/wasmvm/pull/266
Very interesting. Thanks for the report. The pointer 0x01 indicates an empty vector, which happens when required features is empty. However, I do not yet understand how they can end up in this line because they should be handled by the
v.len == cusize(0)
case above.Do you know what system this happens on (OS and CPU)?
alpine:3.12 was used
Could you run the same thing with this patch to understand how the UnmanagedVector looks like? #266
Okay, I will ask to reporter to run with the PR
There is a good chance this is fixed in 0.16.2 & 1.0.0-beta2 due to this patch: https://github.com/CosmWasm/wasmvm/commit/ceaebca68ca2ddbda8cff6bcf2b89316e90121b1
I'm still getting this in wasmvm 1.0.0 as part of wasmd 0.27.0 in a CI job. I'm getting the impression that this can happen when the system runs out of memory. AnalyzeCode
is a bit memory intense as it loads a Wasm file into memory and deserializes the bytecode into a Module
structure. According to this reddit conversation, most APIs in Rust do not check allocation failures. Now when this line fails to allocate memory, it has no result type to let us know: https://github.com/CosmWasm/wasmvm/blob/v1.0.0/libwasmvm/src/cache.rs#L208. Maybe it just gives us an unallocated vector with the 0x1 dummy pointer but the capacity of the data it wanted to allocate.
We got the report from the community. I think it is very rare case and hard to reproduce.
Seems
copyAndDestroyUnmanangedVector
made this panic. Details: https://github.com/terra-money/core/issues/595