You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scheduled tasks keep Bun process alive after graceful shutdown #4415
The HTTP server logs Server closed successfully., but the process remains alive and kill -0 succeeds. The behavior reproduces without Redis or other external connections.
Description
startScheduleRunner() creates a Croner instance with the default unref: false option and discards the instance:
newCron(schedule.cron,callback);
After the HTTP listener closes, the referenced Croner timeout keeps the Bun event loop alive. Containers therefore require a forced kill during shutdown.
Passing { unref: true } to Croner allows the process to exit after the server closes without changing task scheduling while the server is running.
I will submit a focused PR with a regression test.
Activity