Skip to content

Wasm RuntimeError when long strings are put into input fields #2

@flange-ipb

Description

@flange-ipb

When putting in very long strings (larger than around 1MB) into text input fields (Molfile, InChI/AuxInfo, RXN/RD file, RInChI and RAuxInfo fields) the Wasm module call drops a RuntimeError with the message:

  • in Firefox: index out of bounds
  • in Chromium: memory access out of bounds

In further function calls the Wasm module stays unresponsive dropping the same exception, thus the application is not usable anymore. All Wasm modules (the two InChI modules and the RInChI module) are loaded when the page loads, so the only way to get a usable application back is to reload the page.

What doesn't help is to build the Wasm module with the ALLOW_MEMORY_GROWTH linker flag.

What can help is to build the Wasm module with a bigger stack size. The linker flag STACK_SIZE is set to 1 MB at the moment, so that explains my "larger than around 1MB". According to Emscripten's documentation JavaScript strings are passed via the C stack (see note in ccall documentation and implementation).

Needs more investigation ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions