From 2caa4f762939dd535f1c58faab9d72d220570cfd Mon Sep 17 00:00:00 2001 From: hvlad Date: Wed, 14 Apr 2021 16:48:12 +0300 Subject: [PATCH] Additional patch for CORE-6015 : Segfault when using expression index with complex expression. --- src/jrd/vio.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index 3fff0aa3c8..0e4465b435 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -297,7 +297,16 @@ inline void waitGCActive(thread_db* tdbb, const record_param* rpb) Lock temp_lock(tdbb, sizeof(SINT64), LCK_record_gc); temp_lock.setKey(((SINT64) rpb->rpb_page << 16) | rpb->rpb_line); - if (!LCK_lock(tdbb, &temp_lock, LCK_SR, LCK_WAIT)) + SSHORT wait = LCK_WAIT; + + jrd_tra* transaction = tdbb->getTransaction(); + if (transaction->tra_number == rpb->rpb_transaction_nr) + { + // There is no sense to wait for self + wait = LCK_NO_WAIT; + } + + if (!LCK_lock(tdbb, &temp_lock, LCK_SR, wait)) ERR_punt(); LCK_release(tdbb, &temp_lock);