Skip to content

Suppress writes triggered by EOF reads #318

Open
@Lukasa

Description

@Lukasa

When a child channel is "closed while open", we deliver any pending reads into the Channel:

if self.pendingReads.count > 0 && self._isActive {
self.unsatisfiedRead = false
self.deliverPendingReads()
}

After that, we actually close the stream:

if let reason = reason {
// To receive from the network, it must be safe to force-unwrap here.
let err = NIOHTTP2Errors.streamClosed(streamID: self.streamID!, errorCode: reason)
self.errorEncountered(error: err)
} else {
self.closedCleanly()
}

The problem with this is that these reads may trigger some writes. Those writes are doomed to fail, but we let them run into the parent channel before they fail. We could fail them faster by making the stream channel state a little more complex. This will also prevent errors triggered by these writes from having to propagate through the parent channel, which can trigger weird follow-on issues.

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