dynamodb concurrent GetItem timeout on ubuntu22.04
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 1.2k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 12
Description
### Describe the bug
In an ubuntu22.04 environment, timeouts when concurrent GetItem requests are sent to dynamodb.
Here is my code
```cpp
#include
#include
#include
#include
#include
using namespace Aws::DynamoDB::Model;
constexpr uint num_threads = 100;
std::atomic counter = 0;
GetItemRequest get_rand_item_req() {
GetItemRequest req;
req.SetTableName("test.rand");
req.SetConsistentRead(true);
req.AddKey("id", AttributeValue().SetN(std::to_string(rand() % 1000)));
return std::move(req);
}
void worker() {
Aws::Client::ClientConfiguration config;
config.region = "ap-northeast-1";
Aws::DynamoDB::DynamoDBClient client(config);
for (uint i = 0; i < 5; ++i) {
GetItemRequest req = get_rand_item_req();
GetItemOutcome outcome = client.GetItem(req);
if (!outcome.IsSuccess()) {
std::cout << outcome.GetError() << std::endl;
break;
}
counter++;
}
}
int main() {
Aws::SDKOptions options;
Aws::InitAPI(options);
auto start = std::chrono::system_clock::now();
std::vector workers;
for (uint i = 0; i < num_threads; ++i) {
workers.emplace_back(worker);
}
for (auto &w : workers) {
w.join();
}
uint elapsed = std::chrono::duration_cast(
std::chrono::system_clock::now() - start)
.count();
std::cout << "finished counter " << counter << std::endl;
std::cout << "elapsed seconds " << elapsed << std::endl;
Aws::ShutdownAPI(options);
return 0;
}
```
### Expected Behavior
I expect it to output this without any error
```text
finished counter 500
elapsed seconds 0
```
### Current Behavior
```text
HTTP response code: -1
Resolved remote host IP address: 13.248.70.8
Request ID:
Exception name:
Error message: curlCode: 28, Timeout was reached
0 response headers:
HTTP response code: -1
Resolved remote host IP address: 13.248.70.8
Request ID:
Exception name:
Error message: curlCode: 28, Timeout was reached
0 response headers:
finished counter 320
elapsed seconds 268
```
### Reproduction Steps
1. configure your aws credential
2. compile this code
3. run
### Possible Solution
_No response_
### Additional Information/Context
It worked fine if i set num_threads=1 so that GetItem is executed in only one thread.
```text
finished counter 5
elapsed seconds 0
```
Or if i change the operating system to ubuntu20.04
### AWS CPP SDK version used
1.11.90
### Compiler and Version used
gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
### Operating System and version
Ubuntu 22.04.2 LTS
Contributor guide
Assessment
This issue has not been assessed yet.