Files
bun.sh/test/js
Claude Bot 91d9023da8 Fix process hanging when global onmessage is set in main thread
Setting a global onmessage handler in the main thread (e.g., by the lzma
package) was incorrectly keeping the event loop alive and preventing the
process from exiting.

The issue was in BunWorkerGlobalScope.cpp where adding a message event
listener would always call refEventLoop(), even in the main thread. This
was intended for worker threads where message listeners should keep the
worker alive while waiting for messages from the parent.

The fix adds a check to only ref/unref the event loop for message listeners
when we're in a worker thread (not the main thread). Main thread message
handlers are now correctly treated as passive listeners that don't prevent
process exit.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 01:17:12 +00:00
..
2024-12-12 02:07:29 -08:00