From 10f19a12068f00809165f34bda6bf47d5d40d4eb Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Fri, 8 Nov 2024 17:40:25 +0000 Subject: [PATCH] HPCC-32759 Fix deadlock in unordered concat activity with rows > 2MB Signed-off-by: Gavin Halliday --- thorlcr/activities/funnel/thfunnelslave.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/thorlcr/activities/funnel/thfunnelslave.cpp b/thorlcr/activities/funnel/thfunnelslave.cpp index 32962951c52..87e1802f0d6 100644 --- a/thorlcr/activities/funnel/thfunnelslave.cpp +++ b/thorlcr/activities/funnel/thfunnelslave.cpp @@ -246,10 +246,22 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface } void informEos(unsigned input) { - CriticalBlock b(crit); - eoss++; - if (eoss == inputHandlers.ordinality()) - rows.enqueue(NULL); + unsigned numToSignal = 0; + { + CriticalBlock b(crit); + eoss++; + if (eoss == inputHandlers.ordinality()) + rows.enqueue(NULL); + // If the row sizes are very large then it is possible that other threads are waiting + // signal one of them that it can continue - because this thread will add no more records (HPCC-32759) + if (waiting && (totSize <= FUNNEL_MIN_BUFF_SIZE)) + { + numToSignal = 1; + waiting--; + } + } + if (numToSignal) + fullSem.signal(numToSignal); } void abort() {