Skip to content

Assertion failed: old table entries must remain the same #13054

@donalffons

Description

@donalffons

Here is another simplified test case / minimal version to reproduce this error.

main.js:1529 Uncaught (in promise) RuntimeError: abort(Assertion failed: old table entries must remain the same) at Error
    at jsStackTrace (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:1782:19)
    at stackTrace (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:2297:16)
    at abort (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:1523:44)
    at assert (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:701:5)
    at postInstantiation (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:2059:13)
    at https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:2084:20
    at async Promise.all (index 1)
    at abort (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:1529:11)
    at assert (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:701:5)
    at postInstantiation (https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:2059:13)
    at https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/emscripten/build/main.js:2084:20
    at async Promise.all (index 1)

Repo: https://github.com/donalffons/embind-dynamicLibs-02
Deployment: https://embind-dynamic-libs-02-git-master.donalffons.vercel.app/javascript

  • The error occurs during WASM instantiation, randomly, i.e. not every time. Therefore, I perform the WASM instantiation in an infinite loop until the error occurs. When I run this example from the web server deployment, I get this error quite frequently. If I run it from localhost, it seems to occur less frequently.
  • There is 1 MAIN_MODULE, which loads 2 SIDE_MODULES (A and B). SIDE_MODULE A contains problematic code, while SIDE_MODULE B is empty. Only loading SIDE_MODULE A without B does not yield the error.
  • There is virtually no Embind code, no bindings are defined.
  • The problematic code in SIDE_MODULE A is based on code from the OpenCascade project and looks like this.
// library1.cpp
class Standard_MMgrRoot {};

class Standard_MMgrFactory
{
public:
  static Standard_MMgrRoot* GetMMgr();
  ~Standard_MMgrFactory(){} // Error doesn't occur without this line

private:
  Standard_MMgrRoot* myFMMgr;
};

Standard_MMgrRoot* Standard_MMgrFactory::GetMMgr()
{
  static Standard_MMgrFactory aFactory; // Error doesn't occurr without this line
  return aFactory.myFMMgr;
}
  • The error could be reproduced even with a bit less code, but I left a few extra lines in here for context - maybe a more experienced C++ developer can recognize this pattern.

@sbc100, @kripken, if there is anything I can do to support in fixing this (without needing extreme in-depth knowledge of Emscripten internals), hit me 🙂.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions