Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

WebAssembly Error: asm.setThrew

Discussion in '5.6 Beta' started by bigbrainz, Mar 14, 2017.

  1. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    84
    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.
     
  2. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    875
    can you submit a repro for this please? or do you get it on am empty project?
     
  3. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    84
    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!
     
  4. andrzej_cadp

    andrzej_cadp

    Joined:
    Jan 27, 2017
    Posts:
    17
    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:
    Code (csharp):
    1.  
    2. function invoke_viiii(index,a1,a2,a3,a4) {
    3.   try {
    4.     Module["dynCall_viiii"](index,a1,a2,a3,a4);
    5.   } catch(e) {
    6.     if (typeof e !== 'number' && e !== 'longjmp') throw e;
    7.     asm["setThrew"](1, 0); // <-------- here
    8.   }
    9. }
    10.  
    Call stack is very small since it's call from IndexedDB event:
    Code (csharp):
    1.  
    2. invoke_viiii @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:17869
    3. (anonymous) @ wasm-04d0d316-39658:35 //<--- our very small function that receives one bool
    4. (anonymous) @ wasm-04d0d316-58384:9  //<--- dynCall_vii
    5. UnityLoader.5c6a35692a63bc15d48f1ce30104be31.Module.dynCall_vii @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:19456
    6. dynCall @ blob:22aaf41f-3de6-404f-9047-fe818f4130ba:2165 //<--- call to C# code
    7. request.onsuccess //<--- event
    8.  


    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:
    Code (csharp):
    1.  
    2. function invoke_jii(index,a1,a2) {
    3.   try {
    4.     return Module["dynCall_jii"](index,a1,a2);
    5.   } catch(e) {
    6.     if (typeof e !== 'number' && e !== 'longjmp') throw e;
    7.     asm["setThrew"](1, 0); // <--------------- here
    8.   }
    9. }
    10.  
    Code (csharp):
    1.  
    2. func (param i32 i32 i32) (result i64)
    3.   get_local 0
    4.   get_local 1
    5.   get_local 2
    6.   call 634           // <------------- call to invoke_jii from wasm
    7.   i64.extend_u/i32
    8.   get_global 17
    9.   i64.extend_u/i32
    10.   i64.const 32
    11.   i64.shl
    12.   i64.or
    13. end
    14.  
    and callstack:
    Code (csharp):
    1.  
    2. invoke_jii @ blob:08b72968-85be-4f43-b4ac-1ec1df75e5fe:16852
    3. (anonymous) @ wasm-04d0d316-59030:5     //<-- wasm call to invoke_jii
    4. (anonymous) @ wasm-04d0d316-47724:146 //<-- our function for decompressing img
    5. (anonymous) @ wasm-04d0d316-47751:51 //<-- our function for receiving img
    6. (anonymous) @ wasm-04d0d316-47755:6 //<-- lambda called when UnityWebRequest download image
    7.  

    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.
     
    Last edited: Mar 16, 2017
    dejanpej likes this.
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    875
    Got an internal repro myself here and will make a bug.
    Thanks for pointing this out to us!
     
  6. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    875
    Can you guys please still report your repro via bug reporter? What I found might be a bit different.
     
  7. dejanpej

    dejanpej

    Joined:
    Nov 28, 2014
    Posts:
    2
    Can you guys share the links to the opened bug reports?