generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The runtime's invoke function contains an exception catcher while getting the next invocation from AWS API. It goes like this,
} on Exception catch (error, stacktrace) {
await _client.postInvocationError(
nextInvocation.requestId, InvocationError(error, stacktrace));
}The code assumes that nextInvocation is never null and contains the requestId. But there are certain sceranios where the nextInvocation is null. One of them is when the HTTP request inside the _client.getInvocation function throws an HttpException: Connection closed before full header was received exception.
// inside invoke function's try closure
nextInvocation = await _client.getNextInvocation();
// inside the `getNextInvocation` function
final request = await _client.getUrl(Uri.parse(
'http://${runtimeApi}/${runtimeApiVersion}/runtime/invocation/next'));
final response = await request.close();
return NextInvocation.fromResponse(response);The error is reproducible and happens on multiple & regular occasions. When it happens, the requestId is being called on null and throws a process exception and never ends the request. But it could be easily solved by checking whether the nextInvocation is null or not.
} on Exception catch (error, stacktrace) {
if (nextInvocation != null) {
await _client.postInvocationError(
nextInvocation.requestId, InvocationError(error, stacktrace));
}
}I'll submit a PR.
kmcgill88
Metadata
Metadata
Assignees
Labels
No labels