Skip to content

Commit 02afce5

Browse files
authored
Fix TComputeActorAsyncInputHelperSync destruction (#11476)
1 parent 146a0a8 commit 02afce5

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

ydb/library/yql/dq/actors/compute/dq_compute_actor_impl.h

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
202202
}
203203
}
204204

205+
~TDqComputeActorBase() override {
206+
if (Terminated) {
207+
return;
208+
}
209+
Free();
210+
}
211+
212+
void Free() {
213+
auto guard = BindAllocator();
214+
if (!guard) {
215+
return;
216+
}
217+
#define CLEANUP(what) decltype(what) what##_; what.swap(what##_);
218+
CLEANUP(InputChannelsMap);
219+
CLEANUP(SourcesMap);
220+
CLEANUP(InputTransformsMap);
221+
CLEANUP(OutputChannelsMap);
222+
CLEANUP(SinksMap);
223+
CLEANUP(OutputTransformsMap);
224+
#undef CLEANUP
225+
}
226+
205227
void InitMonCounters(const ::NMonitoring::TDynamicCounterPtr& taskCounters) {
206228
if (taskCounters) {
207229
MkqlMemoryQuota = taskCounters->GetCounter("MkqlMemoryQuota");
@@ -504,19 +526,8 @@ class TDqComputeActorBase : public NActors::TActorBootstrapped<TDerived>
504526
}
505527
}
506528

507-
{
508-
if (guard) {
509-
// free MKQL memory then destroy TaskRunner and Allocator
510-
#define CLEANUP(what) decltype(what) what##_; what.swap(what##_);
511-
CLEANUP(InputChannelsMap);
512-
CLEANUP(SourcesMap);
513-
CLEANUP(InputTransformsMap);
514-
CLEANUP(OutputChannelsMap);
515-
CLEANUP(SinksMap);
516-
CLEANUP(OutputTransformsMap);
517-
#undef CLEANUP
518-
}
519-
}
529+
// free MKQL memory then destroy TaskRunner and Allocator
530+
Free();
520531
}
521532

522533
if (RuntimeSettings.TerminateHandler) {

0 commit comments

Comments
 (0)