Skip to content

Can't run pgmock package: Worker has been terminated #20425

Open

Description

@hyuzea

What version of Bun is running?

1.2.17-canary.28+7ee98852c

What platform is your computer?

Linux 6.8.0-60-generic x86_64 x86_64

What steps can reproduce the bug?

import { PostgresMock } from "pgmock";

const pgmock = await PostgresMock.create();
const connectionString = await pgmock.listen(5432);

console.info({connectionString})

What is the expected behavior?

{ connectionString: 'postgresql://postgres:pgmock@localhost:5432' }

What do you see instead?

InvalidStateError: Worker has been terminated

Additional information

No response

Activity

  1. added
    bug
    on Jun 16, 2025
  2. added
    Worker
    and removed on Jun 19, 2025
  3. robobun commented on Aug 9, 2026

    @robobun
    Collaborator

    Update after #37075 merged: the reported error is gone, but pgmock still does not boot, so keeping this open.

    postMessage to a terminated worker is now a no-op like in Node instead of throwing, so the InvalidStateError: Worker has been terminated from pgmock's boot path no longer occurs. Verified by running the snippet from the report: on bun 1.3.14 the boot log contains that DOMException three times before failing; on a build of main (5938918e7) it never appears.

    The boot now fails later with pgmock's own Ping timed out while trying to boot pgmock. Its emulator workers spin on a SharedArrayBuffer that never appears to update, which matches #25677 (WASM writes to a shared WebAssembly.Memory not visible to workers). So the remaining blocker for pgmock looks like that issue rather than this one.

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

    Workerbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions