Skip to content

Bun process does not exit after Tinypool destroy() completes (worker threads remain alive) #29173

@kevgeoleo

Description

@kevgeoleo

What version of Bun is running?

1.3.11-canary.1+9e93bfa1b

What platform is your computer?

Linux 5.10.0-12-amd64 x86_64 x86_64

What steps can reproduce the bug?

Hi,

I would like to report a behavior in Bun that can be reproduced using the below PoC:

  1. worker.mjs
export default ({ a, b }) => a + b;
  1. foo.mjs
import Tinypool from "tinypool";

const pool = new Tinypool({
  filename: new URL("./worker.mjs", import.meta.url).href,
});

const result = await pool.run({ a: 4, b: 6 });
console.log(result); // Expected: 10

await pool.destroy();
  1. package.json
{
  "name": "node-bun-tinypool-poc",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "tinypool": "0.8.3"
  }
}
  1. npm install
  2. bun run foo.mjs

What is the expected behavior?

Print 10 and exit

root@KContainer:~/23263# node foo.mjs
10

What do you see instead?

Prints 10 and does not finish execution

root@KContainer:~/23263# bun run foo.mjs
10
^C

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions