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 | f46e446610a5210a34d2c1a73ba1ca164dd80069 (patch) | |
| tree | ff2039c2e356a564860da196c36149ff07b366ed /qpid/cpp/src | |
| parent | 5c770836ef534630aec5abcebd6808b7f26133f7 (diff) | |
| download | qpid-python-f46e446610a5210a34d2c1a73ba1ca164dd80069.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@1364805 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Link.cpp | 20 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/LinkRegistry.cpp | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index 297c5e22a9..84dd163ac3 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/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/qpid/cpp/src/qpid/broker/LinkRegistry.cpp b/qpid/cpp/src/qpid/broker/LinkRegistry.cpp index 75c311c917..31b113c4d9 100644 --- a/qpid/cpp/src/qpid/broker/LinkRegistry.cpp +++ b/qpid/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)); } } |
