Skip to content

Embedded PG: pglite WASM traps — Emscripten SIDE_MODULE dynamic linking not implemented #231

Description

@acamarata

Status

Integration — pglite boot has never passed on main (failures back to 2026-05-18, predating the v1.2.5 tag). Embedded Postgres does not boot on any platform. This is a real product defect, not CI flake.

Current failure

pglite exited unexpectedly: error while executing at wasm backtrace:
    0: 0x59fed6 - <wasm function 11139>
    1: 0x2408f9 - <wasm function 3146>
    2: 0x23e95c - <wasm function 3144>
    3: 0x50c033 - <wasm function 9716>
    4: 0x50c1ae - <wasm function 9719>
    5: 0x1c15ff - <wasm function 2534>

Root cause

pglite v0.2.17 is an Emscripten SIDE_MODULE. wasmtime_runtime.go defines the GOT.mem / GOT.func namespace globals but nothing performs the actual dynamic-linking relocation, so they keep their initial values and address computation lands outside linear memory.

Progress so far

What a real fix needs

Host-side Emscripten dynamic linking: process the dylink.0 custom section, allocate memory/table segments, apply GOT.mem and GOT.func relocations, and set __memory_base / __table_base / __heap_base before calling __main_argc_argv.

Alternatives worth pricing first:

  • ship pglite built as MAIN_MODULE / standalone WASI instead of SIDE_MODULE
  • pin a pglite build known to run under wasmtime
  • use a runtime with Emscripten dynamic-linking support

Prior work

Unmerged local branches carry earlier attempts: wip/pglite-got, wip/pglite-got-relocation, fix/pglite-trampoline-t11.

Why this issue exists

The four internal/embedded integration tests are being quarantined with t.Skip referencing this issue, so that main can go green for the v1.2.6 patch release. Per the CI/CD-100%-Green doctrine, skipping is only permitted with a linked issue — this is that issue. The skip must be removed as part of fixing this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions