Cognito C++ SDK, Broken Pipe

0

I have an issue when invoking Cognito Admin API calls with C++ SDK both from Lambda and from an external client. I am using the the AWS C++ SDK Version 1.11.75, but have experiences this with previous versions too.

Approximately, 1 in 5 requests (eg AdminUpdateUserAttributes) the API call crashes with a broken pipe.

A typical request (this one executed from a Cognito Post Login Trigger), looks like this:

Aws::CognitoIdentityProvider::Model::AdminUpdateUserAttributesRequest request; request.SetUsername(username); request.SetUserPoolId(user_pool_id); request.SetUserAttributes({Aws::CognitoIdentityProvider::Model::AttributeType().WithName("custom:client_queue").WithValue(queue_url)});

auto outcome{m_idp_client.AdminUpdateUserAttributes(request)}; ...

The SDK is initialized just with default options and Identity Provider Client is default constructed.

Has anyone any ideas how to make this more reliable?

asked a year ago275 views
1 Answer
0

I have had this question also posted on the Github for the C++ SDK, Sergey has provided a solution:

Could you please check if setting Aws::SDKOptions.httpOptions.installSigPipeHandler option will fix your issue?

Aws::SDKOptions options; options.httpOptions.installSigPipeHandler = true;

Also, from https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/basic-use.html#sdk-setting-options:

When installSigPipeHandler is true, the SDK for C++ uses a handler that ignores SIGPIPE signals. For more information on SIGPIPE, see Operation Error 

Signals on the GNU Operating System website. For more information on the curl handler, see CURLOPT_NOSIGNAL explained on the curl website.

The underlying libraries of curl and OpenSSL can send a SIGPIPE signal to notify when the remote side closes a connection. These signals must be handled > by the application. For more information this curl functionality, see libcurl thread safety
on the curl website. This behavior is not automatically built-in to the SDK because signal handlers are global for each application and the library is a 

dependency for the SDK.

Best regards, Sergey

And the github discussion in it is: https://github.com/aws/aws-sdk-cpp/discussions/2494

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions