Skip to content

startWriterTask() discards errors thrown from consuming the httpBody #83

@glbrntt

Description

@glbrntt

When looking through the code I noticed that the Task created in startWriterTask doesn't catch or consume errors and nothing awaits the Task completion. The upshot is that any errors thrown here are ignored which is likely to be problematic.

let task = Task {
dispatchPrecondition(condition: .notOnQueue(Self.streamQueue))
for try await chunk in httpBody {
try await withCheckedThrowingContinuation { continuation in
Self.streamQueue.async {
debug("Output stream delegate produced chunk and suspended producer.")
self.performAction(self.state.producedChunkAndSuspendedProducer(chunk, continuation))
}
}
}
Self.streamQueue.async {
debug("Output stream delegate wrote final chunk.")
self.performAction(self.state.wroteFinalChunk())
}
}

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