mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
This fixes a segmentation fault that occurred when requests were aborted during streaming operations, particularly affecting solid-js SSR applications. The issue manifested when: 1. A TransformStream's writable side was being piped to 2. The request was aborted before the stream finished 3. pipeTo attempted to close an already closed/errored WritableStream 4. This threw "Cannot close a writable stream that is closed or errored" 5. Leading to a segmentation fault in the server Changes: - Add new error code ERR_WRITABLE_STREAM_ALREADY_CLOSED for better error handling - Update writableStreamClose to return appropriate errors: - For closed streams: Use new error code with descriptive message - For errored streams: Return the stored error instead of generic message - Add comprehensive tests for abort scenarios and error code behavior - Tests use IPC for reliable communication and proper stderr handling The fix ensures graceful error handling without crashes when streaming operations are interrupted by client disconnections or request aborts. Fixes #18228 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>