This is an automated email from the ASF dual-hosted git repository.

vmamidi pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.0.x by this push:
     new 3123d53  Revert RS-374 to avoid deadlocks
3123d53 is described below

commit 3123d538db7dab3409fff22d3745a5b96a413516
Author: Vijay Mamidi <vijayabhaskar_mam...@yahoo.com>
AuthorDate: Thu Apr 25 05:50:57 2019 +0800

    Revert RS-374 to avoid deadlocks
---
 iocore/hostdb/HostDB.cc | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index db1139e..6dcf7ea 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -846,21 +846,23 @@ HostDBProcessor::getbyname_imm(Continuation *cont, 
process_hostdb_info_pfn proce
       loop = false; // loop only on explicit set for retry
       // find the partition lock
       ProxyMutex *bucket_mutex = 
hostDB.refcountcache->lock_for_key(hash.hash.fold());
-      SCOPED_MUTEX_LOCK(lock, bucket_mutex, thread);
-      // do a level 1 probe for immediate result.
-      Ptr<HostDBInfo> r = probe(bucket_mutex, hash, false);
-      if (r) {
-        if (r->is_failed()) { // fail, see if we should retry with alternate
-          loop = check_for_retry(hash.db_mark, opt.host_res_style);
-        }
-        if (!loop) {
-          // No retry -> final result. Return it.
-          Debug("hostdb", "immediate answer for %.*s", hash.host_len, 
hash.host_name);
-          HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
-          (cont->*process_hostdb_info)(r.get());
-          return ACTION_RESULT_DONE;
+      MUTEX_TRY_LOCK(lock, bucket_mutex, thread);
+      if (lock.is_locked()) {
+        // do a level 1 probe for immediate result.
+        Ptr<HostDBInfo> r = probe(bucket_mutex, hash, false);
+        if (r) {
+          if (r->is_failed()) { // fail, see if we should retry with alternate
+            loop = check_for_retry(hash.db_mark, opt.host_res_style);
+          }
+          if (!loop) {
+            // No retry -> final result. Return it.
+            Debug("hostdb", "immediate answer for %.*s", hash.host_len, 
hash.host_name);
+            HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
+            (cont->*process_hostdb_info)(r.get());
+            return ACTION_RESULT_DONE;
+          }
+          hash.refresh(); // Update for retry.
         }
-        hash.refresh(); // Update for retry.
       }
     } while (loop);
   }

Reply via email to