From 652a5af4e736ddc40e83b57c28deaf648304b991 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Wed, 8 Aug 2018 18:08:59 +0000 Subject: [PATCH] Lock continuation to avoid handleEvent assert. --- iocore/hostdb/HostDB.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 2726e7c9612..d22d6da1cf0 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -1490,7 +1490,11 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e) } MUTEX_TRY_LOCK_FOR(lock, action.mutex, thread, action.continuation); - if (!lock.is_locked()) { + // We have seen cases were the action.mutex != action.continuation.mutex. + // Since reply_to_cont will call the hanlder on the action.continuation, it is important that we hold + // that mutex. + MUTEX_TRY_LOCK_FOR(lock2, action.continuation->mutex, thread, action.continuation); + if (!lock.is_locked() || !lock2.is_locked()) { remove_trigger_pending_dns(); SET_HANDLER((HostDBContHandler)&HostDBContinuation::probeEvent); thread->schedule_in(this, HOST_DB_RETRY_PERIOD);