aws / aws/aws-sdk-cpp

Failed setting TCP keep-alive interval with error code: 12018

Offen
#2,563 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature-request p3
Vorherrschende Sprache
C++
Sterne
2.2k
Forks
1.2k
Ø Merge
4 T. 11 Std.
Gemergte PRs (30 T.)
13

Beschreibung

### Describe the bug

Creating an instance of `Aws::Client::ClientConfiguration` causes `Failed setting TCP keep-alive interval with error code: 12018` warning message when `region` is fetched from the EC2 Instance Metadata Service. There is an option to get rid of the warnings by setting `enableTcpKeepAlive` to false once the object is created, but the problem is that the warnings are generated in the constructor and when executing the constructor `enableTcpKeepAlive` is always set to true. This causes problems on Windows, since the tcp keep alive setting on WinHttp is not available.

### Expected Behavior

No warnings `Failed setting TCP keep-alive interval with error code: 12018` should be generated. It should be possible to set `enableTcpKeepAlive` to false when creating the object (eg. pass `enableTcpKeepAlive` as a constructor parameter).

### Current Behavior

Warning messages `Failed setting TCP keep-alive interval with error code: 12018` are generated when `Aws::Client::ClientConfiguration` is created.

### Reproduction Steps

```
int main()
{
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Warn;

Aws::InitAPI(options);

Aws::Client::ClientConfiguration config;
config.enableTcpKeepAlive = false;

ShutdownAPI(options);
}
```
Note: You need to make sure that the region will be fetched from the EC2 Instance Metadata Service.

### Possible Solution

Since the tcp keep alive setting on WinHttp is not available, we can just set `enableTcpKeepAlive` to false by default on Windows:
```
@@ -45,7 +45,11 @@ void setLegacyClientConfigurationParameters(ClientConfiguration& clientConfig)
clientConfig.httpRequestTimeoutMs = 0;
clientConfig.requestTimeoutMs = 3000;
clientConfig.connectTimeoutMs = 1000;
+ #ifdef _WIN32
+ clientConfig.enableTcpKeepAlive = false;
+ #else
clientConfig.enableTcpKeepAlive = true;
+ #endif // _WIN32
clientConfig.tcpKeepAliveIntervalMs = 30000;
clientConfig.lowSpeedLimit = 1;
clientConfig.proxyScheme = Aws::Http::Scheme::HTTP;
```

Another possibility is to pass `enableTcpKeepAlive` as a `Aws::Client::ClientConfiguration` constructor parameter.

### Additional Information/Context

_No response_

### AWS CPP SDK version used

1.9.234

### Compiler and Version used

Microsoft Visual C++ Compiler 16.11.32228.343

### Operating System and version

Windows Server 2022 20348.1607

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Suche nach setLegacyClientConfigurationParameters und lies nach, wie Aws::Client::ClientConfiguration initialisiert wird, bevor die Regionssuche über den EC2 Instance Metadata Service erfolgt. Reproduziere die Warnung unter Windows mithilfe des bereitgestellten Beispiels. Die Aufgabe ist erledigt, wenn der Windows-Pfad beim Konfigurieren des Clients keine Warnung mehr ausgibt, ohne das beabsichtigte Verhalten auf anderen Plattformen zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.