Skip to content

Failed to execute 2nd query for SDK 1.11.4/1.10.55 #2336

Closed
@RoyZhang2022

Description

@RoyZhang2022

Describe the bug

The following example code runs two queries for one TimestreamQueryClient in a sequence order. It works fine for 1.9.220 or other 1.9 versions. But for 1.10.55 and 1.11.4, the second query takes long time to execute and timeout in the end.

--build command line

 g++ -Iaws-sdk-cpp/install/include -g testQuery.cpp -Laws-sdk-cpp/install/lib -laws-cpp-sdk-core -laws-cpp-sdk-sts -laws-cpp-sdk-timestream-query
// testQuery.cpp
#include <aws/core/client/ClientConfiguration.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/timestream-query/TimestreamQueryClient.h>
#include <aws/sts/STSClient.h>

#include <aws/timestream-query/model/QueryRequest.h>
#include <aws/timestream-query/model/QueryResult.h>

int
main(int argc, char** argv) {
    Aws::SDKOptions options;
    options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Warn;
    Aws::InitAPI(options);

    {
        Aws::Auth::AWSCredentials credentials;

        credentials.SetAWSAccessKeyId(argv[1]);
        credentials.SetAWSSecretKey(argv[2]);

        Aws::Client::ClientConfiguration clientCfg;
        clientCfg.region = "us-west-2";
        clientCfg.enableEndpointDiscovery = true;
        clientCfg.connectTimeoutMs = 3000;
        clientCfg.requestTimeoutMs = 3000;
        clientCfg.maxConnections = 25;

        Aws::TimestreamQuery::TimestreamQueryClient queryClient(
          credentials, clientCfg);

        Aws::TimestreamQuery::Model::QueryRequest queryRequest;
        queryRequest.SetQueryString("SELECT 1");
        Aws::TimestreamQuery::Model::QueryOutcome outcome =
            queryClient.Query(queryRequest);
        if (!outcome.IsSuccess()) {
            auto error = outcome.GetError();
            std::cout << "ERROR: " << error.GetExceptionName() << ": "
                                << error.GetMessage() << std::endl;
        } else {
            std::cout << "First query is executed successful" << std::endl;
        }

        Aws::TimestreamQuery::Model::QueryRequest queryRequest2;
        queryRequest2.SetQueryString("SELECT 1");

        outcome = queryClient.Query(queryRequest2);
        if (!outcome.IsSuccess()) {
            auto error = outcome.GetError();
            std::cout << "ERROR: " << error.GetExceptionName() << ": "
                                << error.GetMessage() << std::endl;
        } else {
            std::cout << "Second query is executed successful" << std::endl;
        }
    }

    Aws::ShutdownAPI(options);
    return 0;
}

The stack for timeout

(gdb) where
#0  0x00007ffff780bd7f in __GI___poll (fds=0x7fffffffb150, nfds=2, timeout=185) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007ffff769653e in ?? () from /lib/x86_64-linux-gnu/libcurl.so.4
#2  0x00007ffff768f487 in ?? () from /lib/x86_64-linux-gnu/libcurl.so.4
#3  0x00007ffff768f629 in curl_multi_poll () from /lib/x86_64-linux-gnu/libcurl.so.4
#4  0x00007ffff7670e50 in curl_easy_perform () from /lib/x86_64-linux-gnu/libcurl.so.4
#5  0x00007ffff7d24d05 in Aws::Http::CurlHttpClient::MakeRequest(std::shared_ptr<Aws::Http::HttpRequest> const&, Aws::Utils::RateLimits::RateLimiterInterface*, Aws::Utils::RateLimits::RateLimiterInterface*) const () from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-core.so
#6  0x00007ffff7cd12fe in Aws::Client::AWSClient::AttemptOneRequest(std::shared_ptr<Aws::Http::HttpRequest> const&, Aws::AmazonWebServiceRequest const&, char const*, char const*, char const*) const () from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-core.so
#7  0x00007ffff7cd262b in Aws::Client::AWSClient::AttemptExhaustively(Aws::Http::URI const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod, char const*, char const*, char const*) const () from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-core.so
#8  0x00007ffff7cd471b in Aws::Client::AWSJsonClient::MakeRequest(Aws::Http::URI const&, Aws::AmazonWebServiceRequest const&, Aws::Http::HttpMethod, char const*, char const*, char const*) const () from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-core.so
#9  0x00007ffff7cd4e2e in Aws::Client::AWSJsonClient::MakeRequest(Aws::AmazonWebServiceRequest const&, Aws::Endpoint::AWSEndpoint const&, Aws::Http::HttpMethod, char const*, char const*, char const*) const () from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-core.so
#10 0x00007ffff7babc32 in Aws::TimestreamQuery::TimestreamQueryClient::Query(Aws::TimestreamQuery::Model::QueryRequest const&) const ()
   from /home/ubuntu/aws/1.11.4/aws-sdk-cpp/install/lib/libaws-cpp-sdk-timestream-query.so
#11 0x000055555555ac0f in main (argc=3, argv=0x7fffffffe1e8) at testQuery.cpp:49

Expected Behavior

The second query could run successfully in a short time.

Current Behavior

It timeouts on Windows and Linux 64 bit for the second query for SDK 1.10.55 and 1.11.4. I believe this could be seen for other 1.10 and 1.11 versions.

Reproduction Steps

Build the example code and run it.

Possible Solution

Currently workaround is to use 1.9.220.

Additional Information/Context

No response

AWS CPP SDK version used

1.10.55/1.11.4

Compiler and Version used

g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

Operating System and version

Linux ip-xxxxxx 5.15.0-1028-aws #32-Ubuntu SMP Mon Jan 9 12:28:07 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.investigatingThis issue is being investigated and/or work is in progress to resolve the issue.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions