You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by br...@apache.org on 2013/01/30 20:11:24 UTC
git commit: TS-1650: Inactivity cop should use TRY_LOCK instead of
LOCK to avoid deadlock
Updated Branches:
refs/heads/master 8a97bc895 -> bdf58a7d9
TS-1650: Inactivity cop should use TRY_LOCK instead of LOCK to avoid deadlock
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bdf58a7d
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bdf58a7d
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bdf58a7d
Branch: refs/heads/master
Commit: bdf58a7d9d2a3033e87871f4821f8b8c8e744cbf
Parents: 8a97bc8
Author: Brian Geffon <br...@apache.org>
Authored: Wed Jan 30 11:11:15 2013 -0800
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Jan 30 11:11:15 2013 -0800
----------------------------------------------------------------------
CHANGES | 2 ++
iocore/net/Net.cc | 5 +++++
iocore/net/P_Net.h | 3 ++-
iocore/net/UnixNet.cc | 8 +++++++-
4 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdf58a7d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f4ef9c2..85869de 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.3.1
+ *) [TS-1650] Inactivity cop should use TRY_LOCK instead of LOCK to avoid deadlock.
+
*) [TS-1649] Don't use ink_bind if we're not specifying a local port
*) [TS-1667] remove unused enum TSIOBufferDataFlags
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdf58a7d/iocore/net/Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 4daa9f3..ef351e3 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -125,6 +125,11 @@ register_net_stats()
NET_CLEAR_DYN_STAT(socks_connections_currently_open_stat);
#endif
+ RecRegisterRawStat(net_rsb, RECT_PROCESS,
+ "proxy.process.net.inactivity_cop_lock_acquire_failure",
+ RECD_INT, RECP_NULL, (int) inactivity_cop_lock_acquire_failure_stat,
+ RecRawStatSyncSum);
+
}
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdf58a7d/iocore/net/P_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index 4f05731..3445626 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -55,7 +55,8 @@ enum Net_Stats
socks_connections_successful_stat,
socks_connections_unsuccessful_stat,
socks_connections_currently_open_stat,
- Net_Stat_Count
+ Net_Stat_Count,
+ inactivity_cop_lock_acquire_failure_stat
};
struct RecRawStatBlock;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdf58a7d/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 248e14b..d8ea840 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -51,7 +51,13 @@ struct InactivityCop : public Continuation {
forl_LL(UnixNetVConnection, vc, nh->open_list)
nh->cop_list.push(vc);
while (UnixNetVConnection *vc = nh->cop_list.pop()) {
- MUTEX_LOCK(lock, vc->mutex, this_ethread());
+ // If we cannot ge tthe lock don't stop just keep cleaning
+ MUTEX_TRY_LOCK(lock, vc->mutex, this_ethread());
+ if (!lock.lock_acquired) {
+ NET_INCREMENT_DYN_STAT(inactivity_cop_lock_acquire_failure_stat);
+ continue;
+ }
+
if (vc->closed) {
close_UnixNetVConnection(vc, e->ethread);
continue;