From 155fe9e3b32d07e51202f0cb61897b5b8cba8f39 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 29 Nov 2023 16:08:33 -0800 Subject: [PATCH 1/3] pick up fix for s3express create session hang (#576) --- crt/aws-c-s3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crt/aws-c-s3 b/crt/aws-c-s3 index dc9001092..de36fee8f 160000 --- a/crt/aws-c-s3 +++ b/crt/aws-c-s3 @@ -1 +1 @@ -Subproject commit dc9001092b4e7dc3bb2b21631ecb928fe3f98ee4 +Subproject commit de36fee8fe7ab02f10987877ae94a805bf440c1f From 5f1eae687f86a8b356521fa61d6685d10dfecd28 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Wed, 29 Nov 2023 16:09:18 -0800 Subject: [PATCH 2/3] AutoTag PR for v0.24.9 (#577) Co-authored-by: GitHub Actions --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1f1cd637c..04f88883f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.24.8 +0.24.9 From 6f2cede0af3bc039badb8da9db3f3b3671670c8b Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Thu, 30 Nov 2023 12:44:10 -0800 Subject: [PATCH 3/3] MQTT5 Canary Fix (#572) --- bin/mqtt5_canary/main.cpp | 139 ++++++++++++++++++++++++++++++++------ 1 file changed, 117 insertions(+), 22 deletions(-) diff --git a/bin/mqtt5_canary/main.cpp b/bin/mqtt5_canary/main.cpp index 18ad4455d..24901dd78 100644 --- a/bin/mqtt5_canary/main.cpp +++ b/bin/mqtt5_canary/main.cpp @@ -239,8 +239,10 @@ static void s_ParseOptions(int argc, char **argv, struct AppCtx &ctx, struct Aws static void s_Mqtt5CanaryUpdateTpsSleepTime(struct AwsMqtt5CanaryTesterOptions *testerOptions) { - testerOptions->tpsSleepTime = testerOptions->tps == 0 ? 0 : - (aws_timestamp_convert(1, AWS_TIMESTAMP_SECS, AWS_TIMESTAMP_NANOS, NULL) / testerOptions->tps); + testerOptions->tpsSleepTime = + testerOptions->tps == 0 + ? 0 + : (aws_timestamp_convert(1, AWS_TIMESTAMP_SECS, AWS_TIMESTAMP_NANOS, NULL) / testerOptions->tps); } static void s_AwsMqtt5CanaryInitTesterOptions(struct AwsMqtt5CanaryTesterOptions *testerOptions) @@ -257,6 +259,23 @@ static void s_AwsMqtt5CanaryInitTesterOptions(struct AwsMqtt5CanaryTesterOptions testerOptions->memoryCheckIntervalSec = 600; } +struct AwsMqtt5CanaryStatistic +{ + uint64_t totalOperations; + + uint64_t subscribe_attempt; + uint64_t subscribe_succeed; + uint64_t subscribe_failed; + + uint64_t publish_attempt; + uint64_t publish_succeed; + uint64_t publish_failed; + + uint64_t unsub_attempt; + uint64_t unsub_succeed; + uint64_t unsub_failed; +} g_statistic; + struct AwsMqtt5CanaryTestClient { std::shared_ptr client; @@ -380,6 +399,8 @@ static int s_AwsMqtt5CanaryOperationStop(struct AwsMqtt5CanaryTestClient *testCl { return AWS_OP_SUCCESS; } + + g_statistic.totalOperations++; if (testClient->client->Stop()) { testClient->subscriptionCount = 0; @@ -420,12 +441,27 @@ static int s_AwsMqtt5CanaryOperationSubscribe(struct AwsMqtt5CanaryTestClient *t testClient->subscriptionCount++; + ++g_statistic.totalOperations; + ++g_statistic.subscribe_attempt; AWS_LOGF_INFO(AWS_LS_MQTT5_CANARY, "ID:%s Subscribe to topic: %s", testClient->clientId.c_str(), topicArray); - if (testClient->client->Subscribe(packet)) + if (testClient->client->Subscribe(packet, [](int errorcode, std::shared_ptr) { + if (errorcode != 0) + { + ++g_statistic.subscribe_failed; + AWS_LOGF_ERROR( + AWS_LS_MQTT5_CANARY, + "Subscribe failed with errorcode: %d, %s\n", + errorcode, + aws_error_str(errorcode)); + return; + } + ++g_statistic.subscribe_succeed; + })) { return AWS_OP_SUCCESS; } + ++g_statistic.subscribe_failed; AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Subscribe Failed", testClient->clientId.c_str()); return AWS_OP_ERR; } @@ -446,15 +482,18 @@ static int s_AwsMqtt5CanaryOperationUnsubscribeBad(struct AwsMqtt5CanaryTestClie std::shared_ptr unsubscription = std::make_shared(allocator); unsubscription->WithTopicFilters(topics); + ++g_statistic.totalOperations; + ++g_statistic.unsub_attempt; if (testClient->client->Unsubscribe( unsubscription, [testClient](int, std::shared_ptr packet) { if (packet == nullptr) return; if (packet->getReasonCodes()[0] == AWS_MQTT5_UARC_SUCCESS) { + ++g_statistic.unsub_succeed; AWS_LOGF_ERROR( AWS_LS_MQTT5_CANARY, - "ID:%s Unsubscribe Bad Server Failed with errorcode : %s", + "ID:%s Unsubscribe Bad Server Failed with errorcode : %s\n", testClient->clientId.c_str(), packet->getReasonString()->c_str()); } @@ -463,6 +502,7 @@ static int s_AwsMqtt5CanaryOperationUnsubscribeBad(struct AwsMqtt5CanaryTestClie AWS_LOGF_INFO(AWS_LS_MQTT5_CANARY, "ID:%s Unsubscribe Bad", testClient->clientId.c_str()); return AWS_OP_SUCCESS; } + ++g_statistic.unsub_failed; AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Unsubscribe Bad Operation Failed", testClient->clientId.c_str()); return AWS_OP_ERR; } @@ -490,12 +530,16 @@ static int s_AwsMqtt5CanaryOperationUnsubscribe(struct AwsMqtt5CanaryTestClient std::shared_ptr unsubscription = std::make_shared(allocator); unsubscription->WithTopicFilters(topics); + ++g_statistic.totalOperations; + ++g_statistic.unsub_attempt; if (testClient->client->Unsubscribe(unsubscription)) { + ++g_statistic.unsub_succeed; AWS_LOGF_INFO( AWS_LS_MQTT5_CANARY, "ID:%s Unsubscribe from topic: %s", testClient->clientId.c_str(), topicArray); return AWS_OP_SUCCESS; } + ++g_statistic.unsub_failed; AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Unsubscribe Failed", testClient->clientId.c_str()); return AWS_OP_ERR; } @@ -539,13 +583,30 @@ static int s_AwsMqtt5CanaryOperationPublish( .WithUserProperty(std::move(up2)) .WithUserProperty(std::move(up3)); - if (testClient->client->Publish(packetPublish)) + ++g_statistic.totalOperations; + ++g_statistic.publish_attempt; + + if (testClient->client->Publish(packetPublish, [testClient](int errorcode, std::shared_ptr packet) { + if (errorcode != 0) + { + ++g_statistic.publish_failed; + AWS_LOGF_ERROR( + AWS_LS_MQTT5_CANARY, + "ID: %s Publish failed with error code: %d, %s\n", + testClient->clientId.c_str(), + errorcode, + aws_error_str(errorcode)); + return; + } + ++g_statistic.publish_succeed; + })) { AWS_LOGF_INFO( AWS_LS_MQTT5_CANARY, "ID:%s Publish to topic %s", testClient->clientId.c_str(), topicFilter.c_str()); return AWS_OP_SUCCESS; } - AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Publish Failed", testClient->clientId.c_str()); + ++g_statistic.publish_failed; + AWS_LOGF_INFO(AWS_LS_MQTT5_CANARY, "ID:%s Publish Failed\n", testClient->clientId.c_str()); return AWS_OP_ERR; } @@ -689,6 +750,8 @@ int main(int argc, char **argv) AWS_ZERO_STRUCT(operations); testerOptions.operations = operations; + AWS_ZERO_STRUCT(g_statistic); + s_ParseOptions(argc, argv, appCtx, &testerOptions); if (appCtx.uri.GetPort()) { @@ -828,7 +891,8 @@ int main(int argc, char **argv) .WithSocketOptions(socketOptions) .WithBootstrap(&clientBootstrap) .WithPingTimeoutMs(10000) - .WithReconnectOptions({AWS_EXPONENTIAL_BACKOFF_JITTER_NONE, 1000, 120000, 3000}); + .WithReconnectOptions({AWS_EXPONENTIAL_BACKOFF_JITTER_NONE, 1000, 120000, 3000}) + .WithConnackTimeoutMs(3000); if (appCtx.use_tls) { @@ -878,23 +942,25 @@ int main(int argc, char **argv) AWS_LS_MQTT5_CANARY, "ID:%s Lifecycle Event: Connection Success", clients[i].clientId.c_str()); }); - mqtt5Options.WithClientConnectionFailureCallback([&clients, i](const OnConnectionFailureEventData &eventData) { - clients[i].isConnected = false; - AWS_LOGF_ERROR( - AWS_LS_MQTT5_CANARY, - "ID:%s Connection failed with Error Code: %d(%s)", - clients[i].clientId.c_str(), - eventData.errorCode, - aws_error_debug_str(eventData.errorCode)); - }); + mqtt5Options.WithClientConnectionFailureCallback( + [&clients, i](const OnConnectionFailureEventData &eventData) { + clients[i].isConnected = false; + AWS_LOGF_ERROR( + AWS_LS_MQTT5_CANARY, + "ID:%s Connection failed with Error Code: %d(%s)", + clients[i].clientId.c_str(), + eventData.errorCode, + aws_error_debug_str(eventData.errorCode)); + }); mqtt5Options.WithClientDisconnectionCallback([&clients, i](const OnDisconnectionEventData &) { clients[i].isConnected = false; - AWS_LOGF_INFO(AWS_LS_MQTT5_CANARY, "ID:%s Lifecycle Event: Disconnect", clients[i].clientId.c_str()); + AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Lifecycle Event: Disconnect", clients[i].clientId.c_str()); }); mqtt5Options.WithClientStoppedCallback([&clients, i](const OnStoppedEventData &) { - AWS_LOGF_INFO(AWS_LS_MQTT5_CANARY, "ID:%s Lifecycle Event: Stopped", clients[i].clientId.c_str()); + clients[i].isConnected = false; + AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s Lifecycle Event: Stopped", clients[i].clientId.c_str()); }); clients[i].client = Mqtt5::Mqtt5Client::NewMqtt5Client(mqtt5Options, appCtx.allocator); @@ -945,16 +1011,19 @@ int main(int argc, char **argv) if (now > timeTestFinish) { - printf(" Operating TPS average over test: %zu\n\n", operationsExecuted / testerOptions.testRunSeconds); + fprintf( + stderr, + " Operating TPS average over test: %zu\n\n", + operationsExecuted / testerOptions.testRunSeconds); done = true; } if (now > memoryCheckPoint) { const size_t outstanding_bytes = aws_mem_tracer_bytes(allocator); - printf("Summary:\n"); - printf(" Outstanding bytes: %zu\n", outstanding_bytes); - printf(" Operations executed: %zu\n", operationsExecuted); + fprintf(stderr, "Summary:\n"); + fprintf(stderr, " Outstanding bytes: %zu\n", outstanding_bytes); + fprintf(stderr, " Operations executed: %zu\n", operationsExecuted); memoryCheckPoint = now + timeInterval; } @@ -973,6 +1042,32 @@ int main(int argc, char **argv) AWS_LOGF_ERROR(AWS_LS_MQTT5_CANARY, "ID:%s STOP Operation Failed.", client.clientId.c_str()); } } + + fprintf( + stderr, + "Final Statistic: \n" + "total operations: %" PRId64 "\n" + "tps: %" PRId64 "\n" + "subscribe attempt: %" PRId64 "\n" + "subscribe succeed: %" PRId64 "\n" + "subscribe failed: %" PRId64 "\n" + "publish attempt: %" PRId64 "\n" + "publish succeed: %" PRId64 "\n" + "publish failed: %" PRId64 "\n" + "unsub attempt: %" PRId64 "\n" + "unsub succeed: %" PRId64 "\n" + "unsub failed: %" PRId64 "\n", + g_statistic.totalOperations, + g_statistic.totalOperations / testerOptions.testRunSeconds, + g_statistic.subscribe_attempt, + g_statistic.subscribe_succeed, + g_statistic.subscribe_failed, + g_statistic.publish_attempt, + g_statistic.publish_succeed, + g_statistic.publish_failed, + g_statistic.unsub_attempt, + g_statistic.unsub_succeed, + g_statistic.unsub_failed); } aws_mem_tracer_destroy(allocator);