Skip to content

NIOAsyncChannel doesn't flush all its writes if connection is closed #2757

@adam-fowler

Description

@adam-fowler

Expected behavior

That all writes via NIOAsyncChannel.output.write are flushed when a connection is closed.

Actual behavior

If I write a large buffer of over 1MB and exit the closure sent to NIOAsyncChannel.executeThenClose immediately the buffer doesn't get flushed.

Here is the related Slack conversation https://swift-open-source.slack.com/archives/C9MMT6VGB/p1713405447642699

Steps to reproduce

  1. Create HTTP1 server using NIOAsyncChannel, which returns 1MB for every request
  2. curl -H "Connection: close" localhost:8888 --output -

SwiftNIO version/commit hash

2.67.0

System & version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions