diff options
author | ivanmorozov333 <ivanmorozov@ydb.tech> | 2024-10-03 14:45:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-03 14:45:42 +0300 |
commit | 01c8e9fbf440125eb8c24045fbea7d0248e460e9 (patch) | |
tree | ba2b8c742086d0a3b8512ac76278087801d0384f | |
parent | 75c9a74c0ebe75ace3c4cccf62585520590bdb61 (diff) | |
download | ydb-01c8e9fbf440125eb8c24045fbea7d0248e460e9.tar.gz |
fix unregister group race (#10020)
-rw-r--r-- | ydb/core/tx/limiter/grouped_memory/service/process.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ydb/core/tx/limiter/grouped_memory/service/process.h b/ydb/core/tx/limiter/grouped_memory/service/process.h index a1c13e091d5..855b3daeb43 100644 --- a/ydb/core/tx/limiter/grouped_memory/service/process.h +++ b/ydb/core/tx/limiter/grouped_memory/service/process.h @@ -127,12 +127,15 @@ public: } void UnregisterGroup(const bool isPriorityProcess, const ui64 externalGroupId) { - const ui64 internalGroupId = GroupIds.ExtractInternalIdVerified(externalGroupId); - AFL_INFO(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_group")("external_group_id", externalGroupId)( - "internal_group_id", internalGroupId); - UnregisterGroupImpl(internalGroupId); - if (isPriorityProcess && (internalGroupId < GroupIds.GetMinInternalIdDef(internalGroupId))) { - Y_UNUSED(TryAllocateWaiting(isPriorityProcess, 0)); + if (auto internalGroupId = GroupIds.GetInternalIdOptional(externalGroupId)) { + AFL_INFO(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_group")("external_group_id", externalGroupId)( + "internal_group_id", internalGroupId); + UnregisterGroupImpl(*internalGroupId); + if (isPriorityProcess && (*internalGroupId < GroupIds.GetMinInternalIdDef(*internalGroupId))) { + Y_UNUSED(TryAllocateWaiting(isPriorityProcess, 0)); + } + } else { + AFL_WARN(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_absent_group")("external_group_id", externalGroupId); } } |