aws lambda c++ runtime seg fault (but works locally)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
エントリポイント my_handler から開始し、rapidcsv::Document と torch::jit::load に関する AWS Lambda の失敗を再現します。AWS runtime での実行と Debian/CMake での実行を比較し、失敗する各行の前に S3 GetObject の結果と取得したストリームを確認します。segmentation fault の runtime 固有の原因を特定し、検証済みの修正方法を文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am trying to get a simple example running on aws c++ runtime, but it keeps seg faulting when I invoke the lambda function. To start with, the example shown in: https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/ works fine. So, now, I fetch something from a bucket like so:
#include <aws/core/Aws.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <awsdoc/s3/s3_examples.h>
#include <vector>
#include <rapidcsv.h>
#include <torch/torch.h>
#include <torch/script.h> // One-stop header.
#include <iostream>
#include <math.h>
#include <memory>
#include <aws/lambda-runtime/runtime.h>
using namespace torch::indexing;
using namespace Aws::Utils;
using namespace aws::lambda_runtime;
char const TAG[] = "LAMBDA_ALLOC";
static invocation_response my_handler(invocation_request const &req)
{
if (req.payload.length() > 42)
{
return invocation_response::failure("error message here" /*error_message*/,
"error type here" /*error_type*/);
}
Aws::SDKOptions options;
Aws::InitAPI(options);
const Aws::String bucket_name("buckname");
const Aws::String object_name("fname");
Aws::S3::S3Client s3_client;
Aws::S3::Model::GetObjectRequest object_request;
object_request.SetBucket(bucket_name);
object_request.SetKey(object_name);
Aws::S3::Model::GetObjectOutcome get_object_outcome =
s3_client.GetObject(object_request);
auto &retrieved_file = get_object_outcome.GetResultWithOwnership().GetBody();
rapidcsv::Document doc(retrieved_file, rapidcsv::LabelParams(-1, -1)); /// this is where the problem is.
const Aws::String objectKey2("traced_pointnet_model.tar");
Aws::S3::S3Client s3_client2;
Aws::S3::Model::GetObjectRequest object_request2;
object_request2.SetBucket(bucket_name);
object_request2.SetKey(objectKey2);
Aws::S3::Model::GetObjectOutcome get_object_outcome2 =
s3_client2.GetObject(object_request2);
auto &retrieved_file2 = get_object_outcome2.GetResultWithOwnership().GetBody();
torch::jit::script::Module module;
module = torch::jit::load(retrieved_file2); /// this is also where the problem is.
std::cout << "Model Load ok\n";
Aws::ShutdownAPI(options);
return invocation_response::success(tensor_string /*payload*/,
"application/json" /*MIME type*/);
}
int main()
{
run_handler(my_handler);
return 0;
}
the thing is, it compiles and works as expected when I run it locally (debian, cmake), but when I compile it for aws runtime, I get the seg fault.
I have narrowed down the problem to two lines:
rapidcsv::Document doc(retrieved_file, rapidcsv::LabelParams(-1, -1)); /// this is where the problem is.
and also,
module = torch::jit::load(retrieved_file2); /// this is also where the problem is.
I use the rapidcsv header only lib from here: https://github.com/d99kris/rapidcsv and as I said, it works fine locally.
I suspect somehow the runtime is not able to find rapidcsv (but that still fails to explain why it seg faults on module = torch::jit::load(retrieved_file2); :(
Any pointers would be great!
- 主要言語
- C++
- スター
- 465
- フォーク
- 98
- 平均マージ
- 1時間 16分
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
bug-unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100