Skip to content

Commit 3129b5d

Browse files
author
babenko
committed
YT-22846: Fix vptr race in TRoamingRequestControl
09883f9b14b10cfd69e95d7afb810a49aa054682
1 parent b01a836 commit 3129b5d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

yt/yt/core/rpc/roaming_channel.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ class TRoamingRequestControl
1717
{
1818
public:
1919
TRoamingRequestControl(
20-
TFuture<IChannelPtr> asyncChannel,
2120
IClientRequestPtr request,
2221
IClientResponseHandlerPtr responseHandler,
2322
const TSendOptions& options)
2423
: Request_(std::move(request))
2524
, ResponseHandler_(std::move(responseHandler))
2625
, Options_(options)
27-
, StartTime_(TInstant::Now())
26+
{ }
27+
28+
void Initialize(TFuture<IChannelPtr> asyncChannel)
2829
{
2930
if (Options_.Timeout) {
3031
asyncChannel = asyncChannel.WithTimeout(*Options_.Timeout, TFutureTimeoutOptions{
31-
.Error = TError("Error getting channel")
32+
.Error = TError("Error getting channel"),
3233
});
3334
}
3435

@@ -56,7 +57,7 @@ class TRoamingRequestControl
5657
IClientRequestPtr Request_;
5758
IClientResponseHandlerPtr ResponseHandler_;
5859
const TSendOptions Options_;
59-
const TInstant StartTime_;
60+
const TInstant StartTime_ = TInstant::Now();
6061

6162
std::atomic<bool> Semaphore_ = false;
6263

@@ -160,11 +161,12 @@ class TRoamingChannel
160161
}
161162
}
162163

163-
return New<TRoamingRequestControl>(
164-
std::move(asyncChannel),
164+
auto control = New<TRoamingRequestControl>(
165165
std::move(request),
166166
std::move(responseHandler),
167167
options);
168+
control->Initialize(std::move(asyncChannel));
169+
return control;
168170
}
169171

170172
void Terminate(const TError& error) override

0 commit comments

Comments
 (0)