diff options
author | Marc Laukien <marc@zeroc.com> | 2005-11-08 00:01:13 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2005-11-08 00:01:13 +0000 |
commit | 65b74644be770fa3c67f0260fe50462d1e3aa202 (patch) | |
tree | d0d8479b2d45726d7a2b70cfbf8b21c008ab07f2 /cpp | |
parent | Changes to allow test suite to run with compressionn on but not available (diff) | |
download | ice-65b74644be770fa3c67f0260fe50462d1e3aa202.tar.bz2 ice-65b74644be770fa3c67f0260fe50462d1e3aa202.tar.xz ice-65b74644be770fa3c67f0260fe50462d1e3aa202.zip |
fixed bi-dir/shutdown deadlock
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 16 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 46 |
2 files changed, 23 insertions, 39 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 65881c1fa87..2f0e00ef88a 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,14 +1,18 @@ Changes since version 2.1.2 --------------------------- +- Fixed a deadlock during shutdown that could happen with + bi-directional connections. + - Removed ice_default() method from proxies. -- Added downgrade() to IceUtil::RWRecMutex and fixed a bug in upgrade(): - previously, upgrade() was equivalent to calling unlock() followed - by writeLock(), which could allow a thread to acquire a write lock while - another thread was in the middle an upgrade. upgrade() is now atomic, so - whatever state is protected by a read lock is guaranteed to be still unchanged - when upgrade() completes. +- Added downgrade() to IceUtil::RWRecMutex and fixed a bug in + upgrade(): previously, upgrade() was equivalent to calling unlock() + followed by writeLock(), which could allow a thread to acquire a + write lock while another thread was in the middle an + upgrade. upgrade() is now atomic, so whatever state is protected by + a read lock is guaranteed to be still unchanged when upgrade() + completes. - Connection::close(false) (i.e., graceful connection shutdown) now waits until all outstanding requests have completed. diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 38d6cac7992..dc50521f6cb 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1152,41 +1152,21 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter) assert(_state < StateClosing); - // - // Before we set an adapter (or reset it) we wait until the - // dispatch count with any old adapter is zero. - // - // A deadlock can occur if we wait while an operation is - // outstanding on this adapter that holds a lock while calling - // this function (e.g., __getDelegate). - // - // In order to avoid such a deadlock, we only wait if the new - // adapter is different than the current one. - // - // TODO: Verify that this fix solves all cases. - // - if(_adapter.get() != adapter.get()) - { - while(_dispatchCount > 0) - { - wait(); - } + _adapter = adapter; - // - // We never change the thread pool with which we were - // initially registered, even if we add or remove an object - // adapter. - // - _adapter = adapter; - if(_adapter) - { - _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager(); - } - else - { - _servantManager = 0; - } + if(_adapter) + { + _servantManager = dynamic_cast<ObjectAdapterI*>(_adapter.get())->getServantManager(); } + else + { + _servantManager = 0; + } + + // + // We never change the thread pool with which we were initially + // registered, even if we add or remove an object adapter. + // } ObjectAdapterPtr |