Files
bun.sh/src/bun.js
Claude bf80714282 fix: Handle WritableStream close errors gracefully when requests are aborted
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>
2025-07-06 12:47:53 +02:00
..
2025-06-13 19:43:35 +02:00
2025-07-02 20:06:43 -07:00
2025-07-02 22:47:14 -07:00
2025-07-02 20:06:43 -07:00
2025-07-02 20:06:43 -07:00