bun icon indicating copy to clipboard operation
bun copied to clipboard

Bun does not support `SIGTERM` listeners

Open ghoullier opened this issue 2 years ago • 1 comments
trafficstars

What version of Bun is running?

0.4.0

What platform is your computer?

Darwin 20.6.0 x86_64 i386

What steps can reproduce the bug?

  1. create server.js file with following content:
const http = require("node:http");

const server = http.createServer((req, res) => {
  res.write("hello");
  res.end();
});

server.listen(4000, () => {
  console.log("listening", { pid: process.pid });
});

process.on("SIGINT", () => {
  console.log("closing", "sigint");
  server.close(() => {
    console.log("closed");
  });
});
  1. run command below
bun server.js
  1. Stop process using Ctrl+C or run command kill -int <pid>

What is the expected behavior?

Process should output:

closing sigint
closed

What do you see instead?

Callback registered with process.on("SIGINT", callback) is not called.

Additional information

This feature is important to support graceful shutdown in cloud env like kubernetes.

ghoullier avatar Dec 24 '22 15:12 ghoullier

Thanks for reporting, yes, we'll get this added.

Electroid avatar Dec 24 '22 16:12 Electroid

Tracking this here: #429

Electroid avatar Feb 13 '23 20:02 Electroid