Skip to content

Conversation

sebsto
Copy link
Collaborator

@sebsto sebsto commented Oct 14, 2025

This is a follow up to #584 and #585

I tried to modify the Pool to let allow multiple Invocations and continuation. This results in the Lambda Runtime client fetching multiple invocations in parallel (through Get /next)

As expected, the Lambda Runtime HTTP client doesn't support that.

2025-10-14T13:02:21+0200 trace LambdaRuntime : [AWSLambdaRuntime] Handling a new connection
2025-10-14T13:02:21+0200 trace LambdaRuntime : [AWSLambdaRuntime] Handling a new connection
2025-10-14T13:02:21+0200 trace LambdaRuntime : Body="1111" URI=POST /invoke [AWSLambdaRuntime] Processing request
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 [AWSLambdaRuntime] /invoke received invocation, pushing it to the pool and wait for a lambda response
2025-10-14T13:02:21+0200 trace LambdaRuntime : Body="2222" URI=POST /invoke [AWSLambdaRuntime] Processing request
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 [AWSLambdaRuntime] /invoke received invocation, pushing it to the pool and wait for a lambda response
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=GET /2018-06-01/runtime/invocation/next requestId=505191819237833 [AWSLambdaRuntime] /next retrieved invocation
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=GET /2018-06-01/runtime/invocation/next requestId=505191819237833 [AWSLambdaRuntime] Writing response for 202
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=GET /2018-06-01/runtime/invocation/next requestId=505191819237833 [AWSLambdaRuntime] Sending status and headers
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=GET /2018-06-01/runtime/invocation/next requestId=505191819237833 [AWSLambdaRuntime] Sending body
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=GET /2018-06-01/runtime/invocation/next requestId=505191819237833 [AWSLambdaRuntime] Sending end
2025-10-14T13:02:21+0200 trace LambdaRuntime : Event's first bytes="1111" aws-request-id=505191819237833 [AWSLambdaRuntime] Sending invocation event to lambda handler
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Received response to return to client
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Received response to return to client
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] /invoke requestId is valid, sending the response
2025-10-14T13:02:21+0200 error LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Received response for a different requestId
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Writing response for 200
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Sending status and headers
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Writing response for 400
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Sending status and headers
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Sending body
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Received response to return to client
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] /invoke requestId is valid, sending the response
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Writing response for 0
2025-10-14T13:02:21+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819237833 response requestId=505191819237833 [AWSLambdaRuntime] Sending body
2025-10-14T13:02:22+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Received response to return to client
2025-10-14T13:02:22+0200 error LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Received response for a different requestId
2025-10-14T13:02:22+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Writing response for 400
2025-10-14T13:02:22+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Sending status and headers
2025-10-14T13:02:22+0200 trace LambdaRuntime : URI=POST /invoke requestId=505191819281125 response requestId=505191819237833 [AWSLambdaRuntime] Sending body
NIOHTTP1/HTTPServerProtocolErrorHandler.swift:63: Precondition failed

💣 Program crashed: System trap at 0x0000000193aaa22c

Platform: arm64 macOS 26.0.1 (25A362)

Thread 4 "NIO-SGLTN-1-#4" crashed:

  0 HTTPServerProtocolErrorHandler.write(context:data:promise:) + 772 in StreamingNumbers at /Users/stormacq/Documents/amazon/code/swift/lambda/swift-aws-lambda-runtime/Examples/Streaming/.build/checkouts/swift-nio/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift:63:13

    61│             precondition(!self.hasUnterminatedResponse)
    62│         case .head:
    63│             precondition(!self.hasUnterminatedResponse)                                                                                                                                   
      │             ▲
    64│             self.hasUnterminatedResponse = true
    65│         case .body:

@sebsto sebsto self-assigned this Oct 14, 2025
@sebsto sebsto added the 🔨 semver/patch No public API change. label Oct 14, 2025
@sebsto sebsto force-pushed the sebsto/multiple_continuations branch from 136338e to 7979b4c Compare October 14, 2025 11:43
@sebsto sebsto force-pushed the sebsto/multiple_continuations branch from 4162899 to 72b062f Compare October 14, 2025 19:55
@sebsto sebsto closed this Oct 16, 2025
@sebsto sebsto deleted the sebsto/multiple_continuations branch October 16, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant