Description
Hi. I am building an Envoy extension and looking at using AssemblyScript to produce WASM.
I can't get this library running in my extension. When trying to parse some JSON, I see the following stack:
proxy_1 | [2021-12-13 16:10:14.377][8][critical][wasm] [source/extensions/common/wasm/context.cc:1231] wasm log Extension: at: ~lib/rt/tlsf.ts(580:3)
proxy_1 | [2021-12-13 16:10:14.378][8][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Function: proxy_on_vm_start failed: Uncaught RuntimeError: unreachable
proxy_1 | Proxy-Wasm plugin in-VM backtrace:
proxy_1 | 0: 0x3408 - ~lib/rt/tlsf/checkUsedBlock
proxy_1 | 1: 0x3509 - ~lib/rt/tlsf/__realloc
proxy_1 | 2: 0x391a - ~lib/array/ensureSize
proxy_1 | 3: 0x5678 - ~lib/array/Array<~lib/assemblyscript-json/JSON/Value>#push
proxy_1 | 4: 0x5a6c - ~lib/assemblyscript-json/JSON/Handler#addValue
proxy_1 | 5: 0x5b29 - ~lib/assemblyscript-json/JSON/Handler#pushObject
proxy_1 | 6: 0x632f - ~lib/assemblyscript-json/decoder/JSONDecoder<~lib/assemblyscript-json/JSON/Handler>#parseObject
proxy_1 | 7: 0x74c8 - ~lib/assemblyscript-json/decoder/JSONDecoder<~lib/assemblyscript-json/JSON/Handler>#parseValue
proxy_1 | 8: 0x754a - ~lib/assemblyscript-json/decoder/JSONDecoder<~lib/assemblyscript-json/JSON/Handler>#deserialize
proxy_1 | 9: 0x75ba - ~lib/assemblyscript-json/JSON/_JSON.parse<~lib/string/String>
proxy_1 | [2021-12-13 16:10:14.378][8][error][wasm] [source/extensions/common/wasm/wasm.cc:119] Wasm VM failed Failed to start base Wasm
The AS code that provokes this is:
let jsonObj: JSON.Obj = <JSON.Obj>(JSON.parse('{"hello": "world", "o": { "o1": 42 }}'));
I am using the following versions:
"assemblyscript": "^0.14.9"
"assemblyscript-json": "^1.1.0"
Any ideas on where I start to debug this?