Skip to content

Poorly-formed requests crash the NIO server #373

@timburks

Description

@timburks

moving from #350 (comment).

New Issue Checklist

Issue Description

A SwiftNIO-based gRPC server can crash when sent an empty HTTP request, e.g. curl http://localhost:8080:

Complete output when running grpc-swift, including the stack trace and command used
$ swift run EchoNIO serve
starting insecure server
Precondition failed: : file /Users/timburks/Desktop/grpc-swift/.build/checkouts/swift-nio.git-3446246794268775558/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift, line 67
Illegal instruction: 4

As noted by @Lukasa:

That's a NIO precondition, and it gets hit if the HTTPServerRequestParts are being sent out-of-order. Specifically, in this case, we received a sequence of parts where we received a .end before a .head.

Environment

Key Value
OS Version Mac OS 10.14.3
Swift Version 4.2.1
gRPC-Swift Version 0.7.0 / master

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