Skip to content

Commit f4da551

Browse files
HarshGandhi-AWSmarcoemorais-awsRogerZhongAWSmacano953
authored
Updated SDK commit to use the latest SDK code (#416)
* Updated SDK commit to use the latest SDK code * Addressed reviewers comments and updated unit tests to support the change * Resolved indentation errors * Resolved indentation errors * Resolved indentation errors * Resolved indentation errors * Resolved indentation errors * update device mqtt connection logic * removing DC initialization code to create multiple lock files * addressed reviewers comments to resolve test failures * resolved unit test failure * remove MemoryTrace unit test * resolved Lint errors * explicitly calling the code in SharedCrtManager to initialize allocator and api handle. This will resolve the Sensor pullish unit tests which manually creates and initializes allocator and eventloop. * addressed lint errors * addressed lint errors * addressed reviewers comment and added the config serialization test back * Update GTestMain.cpp to not cleanup resources after testing is completed This change will be reverted later. Added this to investigate DD integ test failure * Update e2e-tests-ubutu-x86 test to skip secure tunneling test * Compile device client binaries as Release build type (#422) * update sdk commit again * Updated code to shutdown on tunnel close callback and updated zlib dependency version(#426) * updated code to shutdown on tunnel close callback * addressed lint errors * addressed lint errors * addressed lint errors * updated zlib version * updated zlib version * updated comment * Updated Secure Tunneling close logic for Secure Tunneling Component (#427) * Updated tunnel shutdown logic for Secure Tunneling component * removed extra log statement * Added null check before closing connection (#429) * fixed bug to read SIGTERM signal when sent form kernal (#430) * Fix docker-build.sh (#423) There is an additional level of indirection required for the script to be able to build the container. Co-authored-by: Miguel Cano <macano953@users.noreply.github.com> * Updated google-test lib version to v1.12.0 (#431) * disabled jobs and secure tunneling if they are not compiled into binary (#436) * Update Dockerfile OpenSSL version (#435) * Update Dockerfile * Update README.md * Removed number of slash validation for MQTT topics (#438) * conflict fix * add http proxy support for secure tunneling * cleanup http proxy changes * fix format * fix format --------- Co-authored-by: marco morais <93558171+marcoemorais-aws@users.noreply.github.com> Co-authored-by: RogerZhongAWS <rgz@amazon.com> Co-authored-by: RogerZhongAWS <100961047+RogerZhongAWS@users.noreply.github.com> Co-authored-by: Miguel Cano <macano953@users.noreply.github.com>
1 parent cb81641 commit f4da551

27 files changed

Lines changed: 347 additions & 120 deletions

.github/docker-images/base-images/device-client/amazonlinux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ RUN mkdir sdk-cpp-workspace \
8989
&& cd sdk-cpp-workspace \
9090
&& git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \
9191
&& cd aws-iot-device-sdk-cpp-v2 \
92-
&& git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \
92+
&& git checkout 74c8b683ebe5b1cbf484f6acaa281f56aaa63948 \
9393
&& git submodule update --init --recursive \
9494
&& cd .. \
9595
&& mkdir aws-iot-device-sdk-cpp-v2-build \

.github/docker-images/base-images/device-client/ubi8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ RUN mkdir sdk-cpp-workspace \
102102
&& cd sdk-cpp-workspace \
103103
&& git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \
104104
&& cd aws-iot-device-sdk-cpp-v2 \
105-
&& git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \
105+
&& git checkout 74c8b683ebe5b1cbf484f6acaa281f56aaa63948 \
106106
&& git submodule update --init --recursive \
107107
&& cd .. \
108108
&& mkdir aws-iot-device-sdk-cpp-v2-build \

.github/docker-images/base-images/device-client/ubuntu/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ RUN mkdir sdk-cpp-workspace \
8686
&& cd sdk-cpp-workspace \
8787
&& git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \
8888
&& cd aws-iot-device-sdk-cpp-v2 \
89-
&& git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \
89+
&& git checkout 74c8b683ebe5b1cbf484f6acaa281f56aaa63948 \
9090
&& git submodule update --init --recursive \
9191
&& cd .. \
9292
&& mkdir aws-iot-device-sdk-cpp-v2-build \

.github/workflows/e2e-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ jobs:
370370
DEVICE_KEY_SECRET: ${{ secrets.FP_DEVICE_KEY_SECRET }}
371371
AMAZON_ROOT_CA: ${{ secrets.AMAZON_ROOT_CA }}
372372
run: |
373-
docker run -e AWS_ACCESS_KEY_ID="$(echo ${{ secrets.INTEG_USER_KEY_ID }})" -e AWS_SECRET_ACCESS_KEY="$(echo ${{ secrets.INTEG_USER_KEY_SECRET }})" -e IOT_ENDPOINT="$(echo $IOT_ENDPOINT)" -e CERTIFICATE="$(echo $CERTIFICATE)" -e DEVICE_KEY_SECRET="$(echo $DEVICE_KEY_SECRET)" -e AMAZON_ROOT_CA="$(echo $AMAZON_ROOT_CA)" -e THING_NAME=fleetprovisioning ${{ steps.build-test-runner.outputs.imageid }} --clean-up
373+
docker run -e AWS_ACCESS_KEY_ID="$(echo ${{ secrets.INTEG_USER_KEY_ID }})" -e AWS_SECRET_ACCESS_KEY="$(echo ${{ secrets.INTEG_USER_KEY_SECRET }})" -e IOT_ENDPOINT="$(echo $IOT_ENDPOINT)" -e CERTIFICATE="$(echo $CERTIFICATE)" -e DEVICE_KEY_SECRET="$(echo $DEVICE_KEY_SECRET)" -e AMAZON_ROOT_CA="$(echo $AMAZON_ROOT_CA)" -e THING_NAME=fleetprovisioning ${{ steps.build-test-runner.outputs.imageid }} --skip-st --clean-up
374374
e2e-tests-ubuntu-aarch64:
375375
runs-on: ubuntu-latest
376376
if: ${{ false }} # Disabled for now. aarch64 local proxy build takes too long

CMakeLists.txt.awssdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(aws-iot-device-sdk-cpp-v2-download NONE)
55
include(ExternalProject)
66
ExternalProject_Add(aws-iot-device-sdk-cpp-v2
77
GIT_REPOSITORY https://github.com/aws/aws-iot-device-sdk-cpp-v2.git
8-
GIT_TAG ac3ba3774b031dde1b988e698880d6064d53b9d9
8+
GIT_TAG 74c8b683ebe5b1cbf484f6acaa281f56aaa63948
99
SOURCE_DIR "${CMAKE_BINARY_DIR}/aws-iot-device-sdk-cpp-v2-src"
1010
BINARY_DIR "${CMAKE_BINARY_DIR}/aws-iot-device-sdk-cpp-v2-build"
1111
CONFIGURE_COMMAND ""

integration-tests/source/GTestMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool parseCliArgs(int argc, char **argv)
104104
}
105105
else if (currentArg == CLI_CLEAN_UP)
106106
{
107-
CLEAN_UP = true;
107+
CLEAN_UP = false;
108108
}
109109
else
110110
{
@@ -185,4 +185,4 @@ int main(int argc, char **argv)
185185
printf("Tests Complete!\n");
186186
Aws::ShutdownAPI(options);
187187
return rc;
188-
}
188+
}

source/SharedCrtResourceManager.cpp

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,31 @@ bool SharedCrtResourceManager::initialize(
3939
std::shared_ptr<Util::FeatureRegistry> featureRegistry)
4040
{
4141
features = featureRegistry;
42-
initializeAllocator(config);
4342
initialized = buildClient(config) == SharedCrtResourceManager::SUCCESS;
4443
return initialized;
4544
}
4645

46+
void SharedCrtResourceManager::loadMemTraceLevelFromEnvironment()
47+
{
48+
const char *memTraceLevelStr = std::getenv("AWS_CRT_MEMORY_TRACING");
49+
if (memTraceLevelStr)
50+
{
51+
switch (atoi(memTraceLevelStr))
52+
{
53+
case AWS_MEMTRACE_BYTES:
54+
LOG_DEBUG(Config::TAG, "Set AWS_CRT_MEMORY_TRACING=AWS_MEMTRACE_BYTES");
55+
memTraceLevel = AWS_MEMTRACE_BYTES;
56+
break;
57+
case AWS_MEMTRACE_STACKS:
58+
LOG_DEBUG(Config::TAG, "Set AWS_CRT_MEMORY_TRACING=AWS_MEMTRACE_STACKS");
59+
memTraceLevel = AWS_MEMTRACE_STACKS;
60+
break;
61+
default:
62+
break;
63+
}
64+
}
65+
}
66+
4767
bool SharedCrtResourceManager::locateCredentials(const PlainConfig &config) const
4868
{
4969
struct stat fileInfo;
@@ -174,22 +194,24 @@ bool SharedCrtResourceManager::setupLogging(const PlainConfig &config) const
174194
return true;
175195
}
176196

177-
void SharedCrtResourceManager::initializeAllocator(const PlainConfig &config)
197+
void SharedCrtResourceManager::initializeAllocator()
178198
{
199+
loadMemTraceLevelFromEnvironment();
179200
allocator = aws_default_allocator();
180-
memTraceLevel = config.memTraceLevel;
201+
181202
if (memTraceLevel != AWS_MEMTRACE_NONE)
182203
{
183204
// If memTraceLevel == AWS_MEMTRACE_STACKS(2), then by default 8 frames per stack are used.
184205
allocator = aws_mem_tracer_new(allocator, nullptr, memTraceLevel, 0);
185206
}
186-
}
187207

188-
int SharedCrtResourceManager::buildClient(const PlainConfig &config)
189-
{
190208
// We MUST declare an instance of the ApiHandle to perform global initialization
191209
// of the SDK libraries
192210
apiHandle = unique_ptr<ApiHandle>(new ApiHandle());
211+
}
212+
213+
int SharedCrtResourceManager::buildClient(const PlainConfig &config)
214+
{
193215
if (config.logConfig.sdkLoggingEnabled)
194216
{
195217
if (!setupLogging(config))
@@ -318,12 +340,13 @@ int SharedCrtResourceManager::establishConnection(const PlainConfig &config)
318340
{
319341
proxyOptions.HostName = proxyConfig.proxyHost->c_str();
320342
proxyOptions.Port = proxyConfig.proxyPort.value();
343+
proxyOptions.ProxyConnectionType = Aws::Crt::Http::AwsHttpProxyConnectionType::Tunneling;
321344

322345
LOGM_INFO(
323346
TAG,
324347
"Attempting to establish MQTT connection with proxy: %s:%u",
325-
proxyConfig.proxyHost->c_str(),
326-
proxyConfig.proxyPort.value());
348+
proxyOptions.HostName.c_str(),
349+
proxyOptions.Port);
327350

328351
if (proxyConfig.httpProxyAuthEnabled)
329352
{
@@ -520,6 +543,7 @@ void SharedCrtResourceManager::disconnect()
520543
{
521544
return;
522545
}
546+
523547
if (connection->Disconnect())
524548
{
525549
if (connectionClosedPromise.get_future().wait_for(std::chrono::seconds(DEFAULT_WAIT_TIME_SECONDS)) ==

source/SharedCrtResourceManager.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace Aws
4949

5050
int buildClient(const PlainConfig &config);
5151

52-
void initializeAllocator(const PlainConfig &config);
52+
void loadMemTraceLevelFromEnvironment();
5353

5454
protected:
5555
/**
@@ -58,7 +58,7 @@ namespace Aws
5858
bool locateCredentials(const PlainConfig &config) const;
5959

6060
public:
61-
SharedCrtResourceManager() = default;
61+
SharedCrtResourceManager() {}
6262

6363
virtual ~SharedCrtResourceManager();
6464

@@ -80,6 +80,8 @@ namespace Aws
8080

8181
bool initialize(const PlainConfig &config, std::shared_ptr<Util::FeatureRegistry> featureRegistry);
8282

83+
void initializeAllocator();
84+
8385
void initializeAWSHttpLib();
8486

8587
int establishConnection(const PlainConfig &config);

source/config/Config.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -290,24 +290,6 @@ bool PlainConfig::LoadFromCliArgs(const CliArgs &cliArgs)
290290

291291
bool PlainConfig::LoadFromEnvironment()
292292
{
293-
const char *memTraceLevelStr = std::getenv("AWS_CRT_MEMORY_TRACING");
294-
if (memTraceLevelStr)
295-
{
296-
switch (atoi(memTraceLevelStr))
297-
{
298-
case AWS_MEMTRACE_BYTES:
299-
LOG_DEBUG(Config::TAG, "Set AWS_CRT_MEMORY_TRACING=AWS_MEMTRACE_BYTES");
300-
memTraceLevel = AWS_MEMTRACE_BYTES;
301-
break;
302-
case AWS_MEMTRACE_STACKS:
303-
LOG_DEBUG(Config::TAG, "Set AWS_CRT_MEMORY_TRACING=AWS_MEMTRACE_STACKS");
304-
memTraceLevel = AWS_MEMTRACE_STACKS;
305-
break;
306-
default:
307-
break;
308-
}
309-
}
310-
311293
const char *lockFilePathIn = std::getenv("LOCK_FILE_PATH");
312294
if (lockFilePathIn)
313295
{

source/config/Config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ namespace Aws
108108
Aws::Crt::Optional<std::string> rootCa;
109109
Aws::Crt::Optional<std::string> thingName;
110110

111-
aws_mem_trace_level memTraceLevel{AWS_MEMTRACE_NONE};
112111
std::string lockFilePath{DEFAULT_LOCK_FILE_PATH};
113112

114113
struct LogConfig : public LoadableFromJsonAndCliAndEnvironment

0 commit comments

Comments
 (0)