how to debug wasm compile error in firefox - works fine in chrome

201 views
Skip to first unread message

Gaurav Dewan

unread,
Jul 27, 2016, 10:29:45 AM7/27/16
to emscripten-discuss
failed to compile wasm module: TypeError: wasm error: compile error at offset 11816: too many table elements

Alon Zakai

unread,
Jul 27, 2016, 12:34:48 PM7/27/16
to emscripten-discuss
Probably a mismatch between the compiler that generated it, and the browser. Which compiler version and command was that with? And which browser and version?

If all are up to date, then it might be a compiler or browser bug, a testcase could help.

On Wed, Jul 27, 2016 at 7:29 AM, Gaurav Dewan <gauravd...@gmail.com> wrote:
failed to compile wasm module: TypeError: wasm error: compile error at offset 11816: too many table elements

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gaurav Dewan

unread,
Jul 28, 2016, 10:23:11 AM7/28/16
to emscripten-discuss
Using 1.36.5 emscripten. 
em++ -O3 -s TOTAL_MEMORY=201326592 -s ALIASING_FUNCTION_POINTERS=0 -s BINARYEN=1 -s 'BINARYEN_METHOD="native-wasm"' -s 'BINARYEN_SCRIPTS="spidermonkify.py"' -s GLOBAL_BASE=1000 -s ALIASING_FUNCTION_POINTERS=0 

Updating JS-shell used for compilation and recompiling wasm did not same to change any behavior in both the browsers (latest Firefox Nightly and Chrome Canary)
Then I Updated binaryen used for compilation and recompiled binaryen and wasm - 
Chrome Canary also started showing the error(on updating binaryen !) - out-of-bounds memory access.
Firefox Nightly showed the same error for native wasm method. I tried interpret-binary fallback and changed total memory to 128mb. Got following console output

trying binaryen method: native-wasm
failed to compile wasm
module: TypeError wasm error: compile error at offset 10051: too many table elements
trying binaryen method
: interpret-binary
wasm trap
: highest > memory: 134217728 > 134217724

-s SAFE_HEAP =1 test is green in asm.js build
Changing total memory allocation in wasm build does not help
My initial thought is that some "new C++ application source code" is causing emscripten to generate WASM which firefox js engine parse as invalid. 
This "new C++ application source code" when compiled with older binaryen  works fine on chrome. 
And older builds (with older application source code and older binaryen) continue to work well in both the browsers today.

Is there any wasm-validator tool or tool from which I can map wasm offset/s-expression-functions to C source code/function names ? 

Alon Zakai

unread,
Jul 28, 2016, 5:13:38 PM7/28/16
to emscripten-discuss
I asked and there is currently an arbitrary limit in firefox for the table size, of 128K. I guess your codebase might have a large number of functions in the table (that is, functions that can be indirectly called), or is built with an option that increases that size (like exceptions, for example)? You can look at the table size by looking at the wast, you'll see (table $name0 $name1 ...) and the number of space-delimited names is the size.

If indeed the table size is large (which seems most likely) then this is that temporary firefox limitation (that needs to be fixed).

Gaurav Dewan

unread,
Aug 1, 2016, 5:54:27 AM8/1/16
to emscripten-discuss
Indeed it is issue with size limit of table in firefox as I can confirm with wast:
 
table $b0 $b0 .(same funcname repeated 2000 times) $b1 $b1 ...

Chrome is able to handle atleast 500k table size (maybe there is no limit).
I also verified that when devtools are not open, chrome works fine.

Alon Zakai

unread,
Aug 1, 2016, 12:02:59 PM8/1/16
to emscripten-discuss
Looks like in firefox the limit is being bumped to 1MB,

https://bugzilla.mozilla.org/show_bug.cgi?id=1290402

--
Message has been deleted

Gaurav Dewan

unread,
Aug 4, 2016, 2:53:38 AM8/4/16
to emscripten-discuss
Thanks
Issue found to be fixed in today's firefox nightly build - 51.0a1(2016-08-03)

Alon Zakai

unread,
Aug 4, 2016, 12:46:37 PM8/4/16
to emscripten-discuss
Great!

On Wed, Aug 3, 2016 at 11:53 PM, Gaurav Dewan <gauravd...@gmail.com> wrote:
Thanks
Issue found to be fixed in today's firefox nightly build - 51.0a1(2016-08-03)

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages