From 4b46f55d6a41919bc988531abad5dbdd4678c6dc Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Fri, 21 Aug 2020 19:17:30 -0400 Subject: [PATCH] Fixed a race in storagemanager. On startup it would run a connectivity test to verify it can use S3. The key of the object it tests with is constant, so there can be interference between multiple SM instances that happen to be doing this at the same time. The fix is to include a UUID in the key. --- storage-manager/src/S3Storage.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/storage-manager/src/S3Storage.cpp b/storage-manager/src/S3Storage.cpp index dead77328..f37e5d90a 100644 --- a/storage-manager/src/S3Storage.cpp +++ b/storage-manager/src/S3Storage.cpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include "Utilities.h" using namespace std; @@ -154,7 +157,11 @@ void S3Storage::testConnectivityAndPerms() { boost::shared_array testObj(new uint8_t[1]); testObj[0] = 0; - string testObjKey("connectivity_test"); + boost::uuids::uuid u = boost::uuids::random_generator()(); + ostringstream oss; + oss << u << "connectivity_test"; + + string testObjKey = oss.str(); int err = putObject(testObj, 1, testObjKey); if (err)