Attempted to yield to AsyncThrowingStream in terminated state

i’ve encountered a crash in a NIOHTTP2 application; unfortunately the stack dump is pretty thin.

Thread 2 "NIO-ELT-0-#1" crashed:
[inlined] [system] 0x000055bf2287b0d4 Swift runtime failure: precondition failure in UnidocServer at /swift/swift-unidoc/<compiler-generated>
                   0x000055bf2287b0d4 NIOHTTP2AsyncSequence.Continuation.yield(any:) + 372 in UnidocServer at checkouts/swift-nio-http2/Sources/NIOHTTP2/HTTP2CommonInboundStreamMultiplexer.swift:513:21

it looks like it is failing this precondition:

what are some of the reasons i could be encountering this precondition failure, through “normal” use of NIOHTTP2?

At first blush this looks like a bug in the cancellation code. I'll see if I can draw up a quick reproducer.

Yeah, that's it, I have an easy repro. Will ask one of the team to take a quick look.

2 Likes