swift-server/async-http-client

Crashing on precondition in `HTTP1ConnectionStateMachine`

vojtarylko opened this issue · 1 comments

After upgrading to 1.11.0 our application started crashing frequently with stack trace attached. Before upgrade, app was crashing with #562 – so maybe this regression relates to fix #591.

Received signal 4. Backtrace:
0x564132f83f12, Backtrace.(printBacktrace in _B82A8C0ED7C904841114FDF244F9E58E)(signal: Swift.Int32) -> () at /build/.build/checkouts/swift-backtrace/Sources/Backtrace/Backtrace.swift:66
0x564132f841a7, closure #1 (Swift.Int32) -> () in static Backtrace.Backtrace.install(signals: Swift.Array<Swift.Int32>) -> () at /build/.build/checkouts/swift-backtrace/Sources/Backtrace/Backtrace.swift:79
0x564132f841a7, @objc closure #1 (Swift.Int32) -> () in static Backtrace.Backtrace.install(signals: Swift.Array<Swift.Int32>) -> () at /build/<compiler-generated>:78
0x7f307432341f
0x564132de424f, Swift runtime failure: precondition failure at /build/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ConnectionStateMachine.swift:0
0x564132de424f, AsyncHTTPClient.HTTP1ConnectionStateMachine.runNewRequest(head: NIOHTTP1.HTTPRequestHead, metadata: AsyncHTTPClient.RequestFramingMetadata) -> AsyncHTTPClient.HTTP1ConnectionStateMachine.Action at /build/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ConnectionStateMachine.swift:184
0x564132de05fd, function signature specialization <Arg[2] = Dead> of AsyncHTTPClient.HTTP1ClientChannelHandler.write(context: NIOCore.ChannelHandlerContext, data: NIOCore.NIOAny, promise: Swift.Optional<NIOCore.EventLoopPromise<()>>) -> () at /build/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1ClientChannelHandler.swift:154
0x5641334b450a, NIOCore.ChannelHandlerContext.(invokeWrite in _F5AC316541457BD146E3694279514AA3)(_: NIOCore.NIOAny, promise: Swift.Optional<NIOCore.EventLoopPromise<()>>) -> () at /build/.build/checkouts/swift-nio/Sources/NIOCore/ChannelPipeline.swift:1768
0x5641334b199f
0x5641334a8bc5
0x5641335f9b31, protocol witness for NIOCore.ChannelOutboundInvoker.write(_: NIOCore.NIOAny, promise: Swift.Optional<NIOCore.EventLoopPromise<()>>) -> () in conformance NIOPosix.BaseSocketChannel<A1> : NIOCore.ChannelOutboundInvoker in NIOPosix at /build/<compiler-generated>:0
0x5641334a8e0f, (extension in NIOCore):NIOCore.Channel.write<A>(_: A1, promise: Swift.Optional<NIOCore.EventLoopPromise<()>>) -> () at /build/.build/checkouts/swift-nio/Sources/NIOCore/Channel.swift:228
0x564132de1e6f, function signature specialization <Arg[0] = Existential To Protocol Constrained Generic> of AsyncHTTPClient.HTTP1Connection.(execute0 in _7C38177FD632DDBAA4B2F102B21D5643)(request: AsyncHTTPClient.HTTPExecutableRequest) -> () at /build/.build/checkouts/async-http-client/Sources/AsyncHTTPClient/ConnectionPool/HTTP1/HTTP1Connection.swift:101
0x56413362cb51, closure #4 () -> () in NIOPosix.SelectableEventLoop.run() throws -> () at /build/.build/checkouts/swift-nio/Sources/NIOPosix/SelectableEventLoop.swift:523
0x56413362cb51, reabstraction thunk helper from @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) at /build/<compiler-generated>:0
0x56413362cb51, generic specialization <()> of NIOPosix.withAutoReleasePool<A>(() throws -> A) throws -> A at /build/.build/checkouts/swift-nio/Sources/NIOPosix/SelectableEventLoop.swift:28
0x56413362cb51, NIOPosix.SelectableEventLoop.run() throws -> () at /build/.build/checkouts/swift-nio/Sources/NIOPosix/SelectableEventLoop.swift:522
0x564133618277, static NIOPosix.MultiThreadedEventLoopGroup.(runTheLoop in _C2B1528F4FBA68A3DBFA89DBAEBE9D4D)(thread: NIOPosix.NIOThread, parentGroup: Swift.Optional<NIOPosix.MultiThreadedEventLoopGroup>, canEventLoopBeShutdownIndividually: Swift.Bool, selectorFactory: () throws -> NIOPosix.Selector<NIOPosix.NIORegistration>, initializer: (NIOPosix.NIOThread) -> (), _: (NIOPosix.SelectableEventLoop) -> ()) -> () at /build/.build/checkouts/swift-nio/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift:89
0x564133618277, closure #1 (NIOPosix.NIOThread) -> () in static NIOPosix.MultiThreadedEventLoopGroup.(setupThreadAndEventLoop in _C2B1528F4FBA68A3DBFA89DBAEBE9D4D)(name: Swift.String, parentGroup: NIOPosix.MultiThreadedEventLoopGroup, selectorFactory: () throws -> NIOPosix.Selector<NIOPosix.NIORegistration>, initializer: (NIOPosix.NIOThread) -> ()) -> NIOPosix.SelectableEventLoop at /build/.build/checkouts/swift-nio/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift:110
0x56413361ad9e, partial apply forwarder for closure #1 (NIOPosix.NIOThread) -> () in static NIOPosix.MultiThreadedEventLoopGroup.(setupThreadAndEventLoop in _C2B1528F4FBA68A3DBFA89DBAEBE9D4D)(name: Swift.String, parentGroup: NIOPosix.MultiThreadedEventLoopGroup, selectorFactory: () throws -> NIOPosix.Selector<NIOPosix.NIORegistration>, initializer: (NIOPosix.NIOThread) -> ()) -> NIOPosix.SelectableEventLoop at /build/<compiler-generated>:0
0x56413361b099, reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed NIOPosix.NIOThread) -> () to @escaping @callee_guaranteed (@in_guaranteed NIOPosix.NIOThread) -> (@out ()) at /build/<compiler-generated>:0
0x56413361adbd, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed NIOPosix.NIOThread) -> () to @escaping @callee_guaranteed (@in_guaranteed NIOPosix.NIOThread) -> (@out ()) at /build/<compiler-generated>:0
0x564133647784, closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in static NIOPosix.ThreadOpsPosix.run(handle: inout Swift.Optional<Swift.UInt>, args: NIOPosix.Box<(body: (NIOPosix.NIOThread) -> (), name: Swift.Optional<Swift.String>)>, detachThread: Swift.Bool) -> () at /build/.build/checkouts/swift-nio/Sources/NIOPosix/ThreadPosix.swift:105
0x7f3074317608
0x7f30736cc132
0xffffffffffffffff

Thanks for filing this! We've received some other reports of this failure mode as well, we'll take a look.