Skip to content

Creating a stream and immediately throwing crashes #95

Closed
@Joannis

Description

@Joannis
try await withGRPCClient(transport: transport) { client in
     let agent = Edge_Agent_Services_V1_EdgeAgentService.Client(wrapping: client)
     try await agent.uploadFile { writer in
        throw SomeError() // Error immediately occurs due to file does not exist
    }
}

In a nutshell this is what reproduces the issue. We have a _NIOFileSystem FileHandle in the place of the body:

try await FileSystem.shared.withFileHandle(forReadingAt: FilePath(binary)) { handle in
  // Upload data over gRPC
}

Because the file did not exist, this immediately throws an error resulting in a crash:

GRPCNIOTransportCore/GRPCStreamStateMachine.swift:1062: Fatal error: Server is closed, nothing could have been sent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions