bunqueue v2.0.9
blog · release
bunqueue v2.0.9
Fixes 4 bugs and ships 1 addition. Critical: Memory leak in EventsManager - Cancelled waiters in waitForJobCompletion() were never removed from the completionWaiters map on timeout.
To install bunqueue v2.0.9
Section titled “To install bunqueue v2.0.9”bun add bunqueue@2.0.9npm install bunqueue@2.0.9To upgrade bunqueue
Section titled “To upgrade bunqueue”bun add bunqueue@latestWhat’s new
Section titled “What’s new”- Comprehensive test suites for all bug fixes:
test/bug-memory-leak-waiters.test.ts- 5 tests verifying memory leak fixtest/bug-lost-notification.test.ts- 4 tests verifying notification fixtest/bug-writebuffer-dataloss.test.ts- 10 tests verifying WriteBuffer fixtest/bug-verification-remaining.test.ts- 7 tests verifying CustomId fix and JS concurrency model
Bugfixes
Section titled “Bugfixes”- Critical: Memory leak in EventsManager - Cancelled waiters in
waitForJobCompletion()were never removed from thecompletionWaitersmap on timeout. Now properly cleaned up when timeout fires. - Critical: Lost notification TOCTOU race - Fixed race condition in pull.ts where
notify()could fire betweentryPullFromShard()returning null andwaitForJob()being called. AddedpendingNotificationflag to Shard to capture notifications when no waiters exist. - Critical: WriteBuffer data loss - Added exponential backoff (100ms → 30s), max 10 retries, critical error callback,
stopGracefully()method, and enhanced error callback with retry information. Previously, persistent errors caused infinite retries and shutdown lost pending jobs. - Critical: CustomIdMap race condition - Concurrent pushes with same customId could create duplicates. Moved customIdMap check inside shard write lock for atomic check-and-insert.
Thanks to 1 contributor!
Section titled “Thanks to 1 contributor!”← bunqueue v2.0.3 · Release on GitHub · Commits since v2.0.3 · Full changelog · All posts