Skip to content

Commit

Permalink
Try to fix tsan warning on TUnalignedDeviceHandler destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
drbasic committed Sep 25, 2024
1 parent f2598d8 commit bd5e357
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions cloud/blockstore/libs/service/unaligned_device_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,14 @@ TUnalignedDeviceHandler::TUnalignedDeviceHandler(
, MaxUnalignedBlockCount(maxUnalignedRequestSize / BlockSize)
{}

TUnalignedDeviceHandler::~TUnalignedDeviceHandler()
{
with_lock (RequestsLock) {
AlignedRequests.clear();
UnalignedRequests.clear();
}
}

TFuture<NProto::TReadBlocksLocalResponse> TUnalignedDeviceHandler::Read(
TCallContextPtr ctx,
ui64 from,
Expand Down
2 changes: 2 additions & 0 deletions cloud/blockstore/libs/service/unaligned_device_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class TUnalignedDeviceHandler final
ui32 maxSubRequestSize,
ui32 maxUnalignedRequestSize);

~TUnalignedDeviceHandler() override;

NThreading::TFuture<NProto::TReadBlocksLocalResponse> Read(
TCallContextPtr ctx,
ui64 from,
Expand Down
5 changes: 3 additions & 2 deletions cloud/blockstore/libs/vhost/server_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cloud/blockstore/libs/diagnostics/volume_stats_test.h>
#include <cloud/blockstore/libs/service/device_handler.h>
#include <cloud/blockstore/libs/service/storage_test.h>

#include <cloud/storage/core/libs/common/error.h>
#include <cloud/storage/core/libs/common/sglist_test.h>
#include <cloud/storage/core/libs/diagnostics/logging.h>
Expand All @@ -17,6 +16,7 @@
#include <util/folder/path.h>
#include <util/generic/guid.h>
#include <util/generic/scope.h>
#include <util/system/tempfile.h>
#include <util/thread/factory.h>
#include <util/thread/lfqueue.h>

Expand Down Expand Up @@ -560,7 +560,8 @@ Y_UNIT_TEST_SUITE(TServerTest)

Y_UNIT_TEST(ShouldCancelRequestsInFlightWhenStopEndpointOrStopServer)
{
TString unixSocketPath = CreateGuidAsString() + ".sock";
TString unixSocketPath =
MakeTempName(nullptr, CreateGuidAsString().c_str(), "sock");
const ui32 blockSize = 4096;
const ui64 startIndex = 3;
const ui64 blocksCount = 41;
Expand Down

0 comments on commit bd5e357

Please sign in to comment.