Files
floci/src/main/java
Kenshin Okinaka 4aea1c7c37 fix(elbv2): offload Lambda invocation to a worker thread (#1034)
* fix(elbv2): offload Lambda invocation to a worker thread

ElbV2DataPlane.invokeLambdaTarget called lambdaService.invoke(...)
synchronously inside req.bodyHandler, which runs on a Vert.x
event-loop thread. The invocation blocks for seconds while a cold
Lambda container warms and polls the Runtime API. The Runtime API
itself is a Vert.x HttpServer, so blocking the listener's event loop
starved the runtime — every ALB → Lambda request hung until the
function timed out and returned 502.

Wrap the invocation in vertx.executeBlocking and shape the response
on the resulting Future, mirroring WebSocketHandler.invokeIntegration.

Add ElbV2LambdaTargetDataPlaneIntegrationTest, which deploys a real
Node.js Lambda, sends an HTTP request through the listener port, and
asserts the Lambda's response shape. The existing
ElbV2LambdaTargetIntegrationTest only covered the control plane and
ran with floci.services.elbv2.mock=true, which is why this bug went
undetected. The new test uses @TestProfile to disable the ELBv2
mock so the data plane is exercised end-to-end.

* fix(elbv2): address review feedback on ALB→Lambda fix

- Pass ordered=false to vertx.executeBlocking so independent ALB
  requests run in parallel on the worker pool instead of being
  serialized per context.
- Use StandardCharsets.UTF_8 when encoding the Node.js handler source
  so the generated zip is byte-deterministic across platforms.
- Make cleanup robust to partial failures by null-guarding each
  delete and accepting 404 for the Lambda function delete. Cleanup
  stays as a final ordered @Test (rather than @AfterAll) because
  the Quarkus REST endpoint is torn down before JUnit's @AfterAll
  runs; an HTTP-based teardown there would fail with connection
  refused. Bumped the order to Integer.MAX_VALUE so the cleanup
  step keeps running last regardless of future test additions.

* test(elbv2): align ALB→Lambda dataplane test with the bug repro

Switch the test Lambda from nodejs20.x to python3.11 so it mirrors
the reproduction script in the bug report verbatim. The handler now
returns {"statusCode": 200, "body": "ok"} and the assertion drops
the path-echo and content-type checks — status 200 plus body "ok"
is still a tight enough signal that the entire ALB → Lambda data
plane round-trip succeeded.

* test(elbv2): bump dataplane test runtime to python3.14

Match the latest Python runtime supported by Floci's image map
and keep alignment with the bug repro.
2026-05-26 21:22:50 -05:00
..