mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(lambda): destroy container handle on interrupt and generic exception (#530)
Closes #525. Extends #529's timeout-path fix to the two remaining paths in LambdaExecutorService.executeSync that were still returning a potentially-dirty container to the warm pool. - InterruptedException: the container may still be processing the previous request, so the response from the old invocation could be returned to a new one. Destroy the handle instead of releasing it. - Exception (e.g. runtime API communication failure): container state is unknown. Destroy rather than trust it for reuse. Matches AWS Lambda behavior where a container is discarded after any internal error, not reused. Tests mirror the existing timeoutInvocation_destroysHandle_doesNotRelease pattern, one for each path.
This commit is contained in:
2 files changed
+58
-2
No files matched your search
@@ -113,11 +113,11 @@ public class LambdaExecutorService {
|
||||
null, requestId);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
warmPool.release(handle);
|
||||
warmPool.destroyHandle(handle);
|
||||
return new InvokeResult(200, "Unhandled", buildErrorPayload("Invocation interrupted", "Interrupted"), null, requestId);
|
||||
} catch (Exception e) {
|
||||
LOG.warnv("Invocation error for function {0}: {1}", fn.getFunctionName(), e.getMessage());
|
||||
warmPool.release(handle);
|
||||
warmPool.destroyHandle(handle);
|
||||
return new InvokeResult(200, "Unhandled", buildErrorPayload(e.getMessage(), "InvocationError"), null, requestId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user