WebAssembly Error: asm.setThrew

Howdy. We’re also getting this error in our builds:

TypeError: asm.setThrew is not a function

We’re getting the same error in Firefox 64-bit and Canary. The game stops completely on this error.

We do NOT get this error in 5.6.0b11 if we turn off WebAssembly.

can you submit a repro for this please? or do you get it on am empty project?

I don’t get it in an empty project. I’m trying to see if I can narrow down what’s triggering it. Any idea on your end about what might be calling setThrew . . . to help me narrow it down?

Thanks!

We have the same problem. I’ve tried to track this error. Here is what I’ve found.

In our project this happens in two cases. Both of them are somehow related with jslib code, but I’m not sure if it’s the problem, since second case is not directly called from jslib. Both of them fail at invoke_xxxx functions.

First case is just call from JS IDB event.

Code failed here:

function invoke_viiii(index,a1,a2,a3,a4) {
  try {
    Module["dynCall_viiii"](index,a1,a2,a3,a4);
  } catch(e) {
    if (typeof e !== 'number' && e !== 'longjmp') throw e;
    asm["setThrew"](1, 0); // <-------- here
  }
}

Call stack is very small since it’s call from IndexedDB event:

invoke_viiii @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:17869
(anonymous) @ wasm-04d0d316-39658:35 //<--- our very small function that receives one bool
(anonymous) @ wasm-04d0d316-58384:9  //<--- dynCall_vii
UnityLoader.5c6a35692a63bc15d48f1ce30104be31.Module.dynCall_vii @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:19456
dynCall @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:2165 //<--- call to C# code
request.onsuccess //<--- event

Second case it more complicated. It happens in local lambda expression, created in code called from browser IDB event. This lambda is executed when UnityWebRequest finishes its job.

Code failed here:

function invoke_jii(index,a1,a2) {
  try {
    return Module["dynCall_jii"](index,a1,a2);
  } catch(e) {
    if (typeof e !== 'number' && e !== 'longjmp') throw e;
    asm["setThrew"](1, 0); // <--------------- here
  }
}
func (param i32 i32 i32) (result i64)
  get_local 0
  get_local 1
  get_local 2
  call 634           // <------------- call to invoke_jii from wasm
  i64.extend_u/i32
  get_global 17
  i64.extend_u/i32
  i64.const 32
  i64.shl
  i64.or
end

and callstack:

invoke_jii @ blob:08b72968-85be-4f43-b4ac-1ec1df75e5fe:16852
(anonymous) @ wasm-04d0d316-59030:5     //<-- wasm call to invoke_jii
(anonymous) @ wasm-04d0d316-47724:146 //<-- our function for decompressing img
(anonymous) @ wasm-04d0d316-47751:51 //<-- our function for receiving img
(anonymous) @ wasm-04d0d316-47755:6 //<-- lambda called when UnityWebRequest download image

I have one question. Why functions printed in call stack are not translated with wasm.symbols.unityweb? Is there any signal from browser vendors about wasm debugging with at least symbol names? In my opinion it looks very promising, and far more readable than asm.js, since functions are separated and grouped in debugger.

1 Like

Got an internal repro myself here and will make a bug.
Thanks for pointing this out to us!

Can you guys please still report your repro via bug reporter? What I found might be a bit different.

Can you guys share the links to the opened bug reports?