Skip to content

Runtime Errors: "Alignment Fault" and "Memory Access Out of Bounds" #9

@slashpot

Description

@slashpot

Hi,

I tried to compile this project but encountered the following runtime error:

Uncaught RuntimeError: Aborted(alignment fault)
    at abort (websockets-doom.js:663:41)
    at alignfault (websockets-doom.js:343:3)
    at imports.<computed> (websockets-doom.js:9675:20)
    at websockets-doom.wasm (websockets-doom.wasm:0x5ad94a)
    at websockets-doom.wasm.SaveGameSettings (d_net.c:137:31)
    at websockets-doom.wasm.D_CheckNetGame (d_net.c:238:5)
    at websockets-doom.wasm.D_DoomMain (d_main.c:1648:5)
    at websockets-doom.wasm.main (i_main.c:68:5)
    at ret.<computed> (websockets-doom.js:9701:20)
    at websockets-doom.js:695:12

I found that this error is caused by the emscripten flag SAFE_HEAP=1. After setting this flag to 0, the game reaches the menu screen. However, when starting a level, the game freezes with the following runtime error:

websockets-doom.js:54 Uncaught RuntimeError: memory access out of bounds
    at websockets-doom.wasm.P_PlayerThink (p_user.c:267:40)
    at websockets-doom.wasm.P_Ticker (p_tick.c:145:6)
    at websockets-doom.wasm.G_Ticker (g_game.c:870:9)
    at websockets-doom.wasm.RunTic (d_net.c:88:5)
    at websockets-doom.wasm.TryRunTics (d_loop.c:696:13)
    at websockets-doom.wasm.D_RunFrame (d_main.c:395:5)
    at websockets-doom.wasm.dynCall_v (websockets-doom.wasm:0x4fe465)
    at ret.<computed> (websockets-doom.js:9439:24)
    at websockets-doom.js:647:12
    at browserIterationFunc (websockets-doom.js:8607:41)

I tried the following flags, but the issue persists:

-s STACK_SIZE=64mb -s INITIAL_HEAP=64mb -s DEFAULT_PTHREAD_STACK_SIZE=64mb -s INITIAL_MEMORY=256MB

I've tested on my Mac M1, x86_64 Linux, and the Gitpod workspace for this repo (https://github.com/gitpod-io/doom), all resulting in the same error. I'm running out of ideas — can anyone help check this?

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