Skip to content

Commit 2dae2ec

Browse files
fix unregister group race (#10020) (#10039)
Co-authored-by: ivanmorozov333 <[email protected]>
1 parent 602dfb0 commit 2dae2ec

File tree

1 file changed

+9
-6
lines changed
  • ydb/core/tx/limiter/grouped_memory/service

1 file changed

+9
-6
lines changed

ydb/core/tx/limiter/grouped_memory/service/process.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,15 @@ class TProcessMemoryScope {
127127
}
128128

129129
void UnregisterGroup(const bool isPriorityProcess, const ui64 externalGroupId) {
130-
const ui64 internalGroupId = GroupIds.ExtractInternalIdVerified(externalGroupId);
131-
AFL_INFO(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_group")("external_group_id", externalGroupId)(
132-
"internal_group_id", internalGroupId);
133-
UnregisterGroupImpl(internalGroupId);
134-
if (isPriorityProcess && (internalGroupId < GroupIds.GetMinInternalIdDef(internalGroupId))) {
135-
Y_UNUSED(TryAllocateWaiting(isPriorityProcess, 0));
130+
if (auto internalGroupId = GroupIds.GetInternalIdOptional(externalGroupId)) {
131+
AFL_INFO(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_group")("external_group_id", externalGroupId)(
132+
"internal_group_id", internalGroupId);
133+
UnregisterGroupImpl(*internalGroupId);
134+
if (isPriorityProcess && (*internalGroupId < GroupIds.GetMinInternalIdDef(*internalGroupId))) {
135+
Y_UNUSED(TryAllocateWaiting(isPriorityProcess, 0));
136+
}
137+
} else {
138+
AFL_WARN(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_absent_group")("external_group_id", externalGroupId);
136139
}
137140
}
138141

0 commit comments

Comments
 (0)