mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
fix memory leak at creation of curl connection in azure sdk
This commit is contained in:
parent
cdbe145bc1
commit
e9f80c650a
2
contrib/azure
vendored
2
contrib/azure
vendored
@ -1 +1 @@
|
||||
Subproject commit e4fcdfc81e337e589ce231a452dcc280fcbb3f99
|
||||
Subproject commit 096049bf24fffafcaccc132b9367694532716731
|
41
src/Disks/tests/gtest_azure_sdk.cpp
Normal file
41
src/Disks/tests/gtest_azure_sdk.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <azure/storage/blobs/blob_options.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Common/logger_useful.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if USE_AZURE_BLOB_STORAGE
|
||||
|
||||
#include <azure/storage/blobs.hpp>
|
||||
#include <azure/storage/common/internal/xml_wrapper.hpp>
|
||||
#include <azure/storage/blobs/blob_container_client.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(AzureXMLWrapper, TestLeak)
|
||||
{
|
||||
std::string str = "<hello>world</hello>";
|
||||
|
||||
Azure::Storage::_internal::XmlReader reader(str.c_str(), str.length());
|
||||
Azure::Storage::_internal::XmlReader reader2(std::move(reader));
|
||||
Azure::Storage::_internal::XmlReader reader3 = std::move(reader2);
|
||||
reader3.Read();
|
||||
}
|
||||
|
||||
TEST(AzureBlobContainerClient, CurlMemoryLeak)
|
||||
{
|
||||
using Azure::Storage::Blobs::BlobContainerClient;
|
||||
using Azure::Storage::Blobs::BlobClientOptions;
|
||||
|
||||
static constexpr auto unavailable_url = "http://unavailable:19999/bucket";
|
||||
static constexpr auto container = "container";
|
||||
|
||||
BlobClientOptions options;
|
||||
options.Retry.MaxRetries = 0;
|
||||
|
||||
auto client = std::make_unique<BlobContainerClient>(BlobContainerClient::CreateFromConnectionString(unavailable_url, container, options));
|
||||
EXPECT_THROW({ client->ListBlobs(); }, Azure::Core::Http::TransportException);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Common/logger_useful.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if USE_AZURE_BLOB_STORAGE
|
||||
|
||||
#include <azure/storage/blobs.hpp>
|
||||
#include <azure/storage/common/internal/xml_wrapper.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
TEST(AzureXMLWrapper, TestLeak)
|
||||
{
|
||||
std::string str = "<hello>world</hello>";
|
||||
|
||||
Azure::Storage::_internal::XmlReader reader(str.c_str(), str.length());
|
||||
Azure::Storage::_internal::XmlReader reader2(std::move(reader));
|
||||
Azure::Storage::_internal::XmlReader reader3 = std::move(reader2);
|
||||
reader3.Read();
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user