diff options
author | Alan Conway <aconway@apache.org> | 2012-07-23 21:29:08 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-07-23 21:29:08 +0000 |
commit | 96dc5f4c55cc14260a27814678f19a9233d8e24b (patch) | |
tree | d9776420c2eda5dc4ba6aa7e8cbb46d70677cf8f /cpp | |
parent | 776eb5b4dd4ae24a5371086128b884ed544c67f2 (diff) | |
download | qpid-python-96dc5f4c55cc14260a27814678f19a9233d8e24b.tar.gz |
QPID-4163: Deadlock between LinkRegistry and TimerTask locks
Previously TimerTask::cancel was being called with locks held in this stack trace, causing a deadlock.
Moved call to cancel outside of the lock.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1364805 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/broker/Link.cpp | 20 | ||||
-rw-r--r-- | cpp/src/qpid/broker/LinkRegistry.cpp | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp index 297c5e22a9..84dd163ac3 100644 --- a/cpp/src/qpid/broker/Link.cpp +++ b/cpp/src/qpid/broker/Link.cpp @@ -249,17 +249,19 @@ void Link::established(Connection* c) if (!hideManagement() && agent) agent->raiseEvent(_qmf::EventBrokerLinkUp(addr.str())); - - Mutex::ScopedLock mutex(lock); - setStateLH(STATE_OPERATIONAL); - currentInterval = 1; - visitCount = 0; - connection = c; - - if (closing) + bool isClosing = false; + { + Mutex::ScopedLock mutex(lock); + setStateLH(STATE_OPERATIONAL); + currentInterval = 1; + visitCount = 0; + connection = c; + isClosing = closing; + } + if (isClosing) destroy(); else // Process any IO tasks bridges added before established. - connection->requestIOProcessing (boost::bind(&Link::ioThreadProcessing, this)); + c->requestIOProcessing (boost::bind(&Link::ioThreadProcessing, this)); } diff --git a/cpp/src/qpid/broker/LinkRegistry.cpp b/cpp/src/qpid/broker/LinkRegistry.cpp index 75c311c917..31b113c4d9 100644 --- a/cpp/src/qpid/broker/LinkRegistry.cpp +++ b/cpp/src/qpid/broker/LinkRegistry.cpp @@ -326,13 +326,13 @@ void LinkRegistry::notifyConnection(const std::string& key, Connection* c) if (l->second->pendingConnection(host, port)) { link = l->second; connections[key] = link->getName(); - link->established(c); break; } } } if (link) { + link->established(c); c->setUserId(str(format("%1%@%2%") % link->getUsername() % realm)); } } |