Question about timeouts
还没有人认领这个 Issue。
评估
调研方向
从 AWS Lambda C++ runtime 示例以及 issue 中展示的 run_handler 调用开始;复现 5 秒执行与 70 秒执行之间的差异。确定超时行为和配置记录在哪里,然后使相关的开发者参考足够清晰,以解释观察到的重启和配置选项。
由索引模型根据 Issue 内容生成。
描述
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;
}
- 主要语言
- C++
- 星标
- 465
- 派生
- 98
- 平均合并
- 1 小时 16 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
awslabs/aws-lambda-cpp 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
awslabs/aws-lambda-cpp#205 ·
-
难度 3/5 1-2 天 新手友好度 35/100
awslabs/aws-lambda-cpp#196 ·
-
难度 4/5 3-5 天 新手友好度 35/100
awslabs/aws-lambda-cpp#195 · 11 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
awslabs/aws-lambda-cpp#194 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
awslabs/aws-lambda-cpp#188 ·
查看 awslabs/aws-lambda-cpp 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
AXERA-TECH/ax-llm#77 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
games-on-whales/wolf#509 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
-
bug-unconfirmed
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 74/100
NVIDIA/cuda-samples#453 ·