From 7936c3661dbafa1cb0ce5a72b50062f069a514c9 Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Mon, 15 Jan 2024 17:50:03 +0000 Subject: [PATCH] HPCC-31111 Fix unusual roxie crash on keyed join within library Only occurs if the library is used more than once within the same query and the keyed joins execute at the same time. Signed-off-by: Gavin Halliday --- common/thorhelper/roxierow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/thorhelper/roxierow.cpp b/common/thorhelper/roxierow.cpp index 48d297361be..ea4d7706e42 100644 --- a/common/thorhelper/roxierow.cpp +++ b/common/thorhelper/roxierow.cpp @@ -488,9 +488,12 @@ class CAllocatorCache : public CSimpleInterfaceOf CAllocatorCacheItem *container = _lookup(meta, activityId, flags); if (container) { - if (0 == (roxiemem::RHFunique & flags)) + if (0 == ((roxiemem::RHFunique|roxiemem::RHFblocked) & flags)) return LINK(&container->queryElement()); - // if in cache but unique, reuse allocatorId + // If in cache but unique, reuse allocatorId, but create a unique allocator (and heap) + // If blocked the allocator must not be commoned up! (The underlying heap will be within roxiemem.) + // This is very unusual, but can happen if a library is used more than once within the same query + // since you will have multiple activity instances with the same activityId. SpinUnblock b(allAllocatorsLock); return callback->createAllocator(this, meta, activityId, container->queryAllocatorId(), flags); }