Question about timeouts
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the AWS Lambda C++ runtime example and the run_handler call shown in the issue; reproduce the difference between 5-second and 70-second executions. Determine where timeout behavior and configuration are documented, then make the relevant developer reference clear enough to explain the observed restarts and configuration options.
Written by the indexing model from the issue text.
Description
Hello,
I have followed the examples here: https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/
When I run my internal execution so that it takes 5 seconds everything works fine. But when I run it for 70 seconds I never get any response and the lambda function seems to be restarting several times. My guess is that is has to do with some timeouts. But how do I configure them? I cannot find any good developer reference.
static invocation_response my_handler(invocation_request const& req, Aws::S3::S3Client const& client) {
using namespace Aws::Utils::Json;
JsonValue json(req.payload);
if (!json.WasParseSuccessful()) {
return invocation_response::failure("Failed to parse input JSON", "InvalidJSON");
}
auto v = json.View();
if (!v.ValueExists("s3bucket") || !v.ValueExists("s3key") || !v.GetObject("s3bucket").IsString() ||
!v.GetObject("s3key").IsString()) {
return invocation_response::failure("Missing input value s3bucket or s3key", "InvalidJSON");
}
auto bucket = v.GetString("s3bucket");
auto key = v.GetString("s3key");
AWS_LOGSTREAM_INFO(TAG, "Attempting to download file from s3://" << bucket << "/" << key);
// Internal execution about 70 seconds...
string response = "Success!";
return invocation_response::success("We did it! Response: " + response, "application/json");
}
std::function<std::shared_ptr<Aws::Utils::Logging::LogSystemInterface>()> GetConsoleLoggerFactory() {
return [] {
return Aws::MakeShared<Aws::Utils::Logging::ConsoleLogSystem>(
"console_logger", Aws::Utils::Logging::LogLevel::Info);
};
}
Aws::Client::ClientConfiguration getS3Config() {
Aws::Client::ClientConfiguration config;
config.region = "us-east-1";
config.scheme = Aws::Http::Scheme::HTTP;
return config;
}
Aws::Client::ClientConfiguration getS3ConfigWithBundle() {
cout << "USING S3 REGION: " << Aws::Environment::GetEnv("AWS_REGION") << endl;
Aws::Client::ClientConfiguration config;
config.region = Aws::Environment::GetEnv("AWS_REGION");
config.scheme = Aws::Http::Scheme::HTTP;
return config;
}
void run_lambda_handler() {
Aws::S3::S3Client client(getS3ConfigWithBundle());
auto handler_fn = [&client](aws::lambda_runtime::invocation_request const& req) {
return my_handler(req, client);
};
run_handler(handler_fn);
}
int main(int argc, const char **argv) {
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
options.loggingOptions.logger_create_fn = GetConsoleLoggerFactory();
Aws::InitAPI(options);
run_lambda_handler();
Aws::ShutdownAPI(options);
return 0;
}
- Dominant language
- C++
- Stars
- 465
- Forks
- 98
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from awslabs/aws-lambda-cpp
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
awslabs/aws-lambda-cpp#205 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
awslabs/aws-lambda-cpp#196 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
awslabs/aws-lambda-cpp#195 · 11 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
awslabs/aws-lambda-cpp#194 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
awslabs/aws-lambda-cpp#188 ·
All issues in awslabs/aws-lambda-cpp
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·