summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-07-10 15:32:48 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-07-10 15:32:48 +0200
commitc8d567340f25511927032c9c17f63d3c15f90a4d (patch)
treea76b2434375b99b9ca0bf68e41e02757dcd79ae2
parentFix VC++ version used with Python 2.7.x builds (diff)
downloadice-c8d567340f25511927032c9c17f63d3c15f90a4d.tar.bz2
ice-c8d567340f25511927032c9c17f63d3c15f90a4d.tar.xz
ice-c8d567340f25511927032c9c17f63d3c15f90a4d.zip
Fixed ICE-8244 - Ice/background test failure
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp26
-rw-r--r--csharp/src/Ice/ConnectRequestHandler.cs25
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java27
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/AllTests.java13
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java27
-rw-r--r--java/test/src/main/java/test/Ice/background/AllTests.java9
6 files changed, 84 insertions, 43 deletions
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index 285402b333a..6bcb1bbc0c3 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -146,7 +146,7 @@ ConnectRequestHandler::setConnection(const Ice::ConnectionIPtr& connection, bool
{
{
Lock sync(*this);
- assert(!_exception && !_connection);
+ assert(!_flushing && !_exception && !_connection);
_connection = connection;
_compress = compress;
}
@@ -172,19 +172,15 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
{
{
Lock sync(*this);
- assert(!_initialized && !_exception);
+ assert(!_flushing && !_initialized && !_exception);
+ _flushing = true; // Ensures request handler is removed before processing new requests.
ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
-
- _proxies.clear();
- _proxy = 0; // Break cyclic reference count.
- notifyAll();
}
//
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
+ // NOTE: remove the request handler *before* notifying the requests that the connection
+ // failed. It's important to ensure that future invocations will obtain a new connect
+ // request handler once invocations are notified.
//
try
{
@@ -203,6 +199,14 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
}
}
_requests.clear();
+
+ {
+ Lock sync(*this);
+ _flushing = false;
+ _proxies.clear();
+ _proxy = 0; // Break cyclic reference count.
+ notifyAll();
+ }
}
void
@@ -227,7 +231,7 @@ ConnectRequestHandler::initialized()
}
else
{
- while(_flushing && !_exception)
+ while(_flushing)
{
wait();
}
diff --git a/csharp/src/Ice/ConnectRequestHandler.cs b/csharp/src/Ice/ConnectRequestHandler.cs
index a03a6adb02c..4378f1761dc 100644
--- a/csharp/src/Ice/ConnectRequestHandler.cs
+++ b/csharp/src/Ice/ConnectRequestHandler.cs
@@ -109,7 +109,7 @@ namespace IceInternal
{
lock(this)
{
- Debug.Assert(_exception == null && _connection == null);
+ Debug.Assert(!_flushing && _exception == null && _connection == null);
_connection = connection;
_compress = compress;
}
@@ -134,18 +134,15 @@ namespace IceInternal
{
lock(this)
{
- Debug.Assert(!_initialized && _exception == null);
+ Debug.Assert(!_flushing && !_initialized && _exception == null);
_exception = ex;
- _proxies.Clear();
- _proxy = null; // Break cyclic reference count.
- Monitor.PulseAll(this);
+ _flushing = true; // Ensures request handler is removed before processing new requests.
}
//
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
+ // NOTE: remove the request handler *before* notifying the requests that the connection
+ // failed. It's important to ensure that future invocations will obtain a new connect
+ // request handler once invocations are notified.
//
try
{
@@ -164,6 +161,14 @@ namespace IceInternal
}
}
_requests.Clear();
+
+ lock(this)
+ {
+ _flushing = false;
+ _proxies.Clear();
+ _proxy = null; // Break cyclic reference count.
+ Monitor.PulseAll(this);
+ }
}
//
@@ -197,7 +202,7 @@ namespace IceInternal
}
else
{
- while(_flushing && _exception == null)
+ while(_flushing)
{
Monitor.Wait(this);
}
diff --git a/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
index b8e9426cc63..aeb2f45649c 100644
--- a/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
@@ -118,7 +118,7 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- assert(_exception == null && _connection == null);
+ assert(!_flushing && _exception == null && _connection == null);
_connection = connection;
_compress = compress;
}
@@ -145,18 +145,15 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- assert(!_initialized && _exception == null);
+ assert(!_flushing && !_initialized && _exception == null);
+ _flushing = true; // Ensures request handler is removed before processing new requests.
_exception = ex;
- _proxies.clear();
- _proxy = null; // Break cyclic reference count.
- notifyAll();
}
//
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
+ // NOTE: remove the request handler *before* notifying the requests that the connection
+ // failed. It's important to ensure that future invocations will obtain a new connect
+ // request handler once invocations are notified.
//
try
{
@@ -175,6 +172,14 @@ public class ConnectRequestHandler
}
}
_requests.clear();
+
+ synchronized(this)
+ {
+ _flushing = false;
+ _proxies.clear();
+ _proxy = null; // Break cyclic reference count.
+ notifyAll();
+ }
}
//
@@ -227,7 +232,7 @@ public class ConnectRequestHandler
// only true for a short period of time.
//
boolean interrupted = false;
- while(_flushing && _exception == null)
+ while(_flushing)
{
try
{
@@ -293,7 +298,7 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- assert(_connection != null && !_initialized);
+ assert(!_flushing && _connection != null && !_initialized);
//
// We set the _flushing flag to true to prevent any additional queuing. Callers
diff --git a/java-compat/test/src/main/java/test/Ice/background/AllTests.java b/java-compat/test/src/main/java/test/Ice/background/AllTests.java
index 18155e3cf54..7a0cff17c69 100644
--- a/java-compat/test/src/main/java/test/Ice/background/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/background/AllTests.java
@@ -501,6 +501,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -609,6 +610,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
background.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait);
@@ -621,6 +623,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
background.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait);
@@ -665,6 +668,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
background.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait);
@@ -698,6 +702,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -724,6 +729,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -765,6 +771,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -804,6 +811,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
background.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait);
@@ -1071,6 +1079,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1083,6 +1092,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1245,6 +1255,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1257,6 +1268,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1299,6 +1311,7 @@ public class AllTests
}
catch(Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java
index bf98fe557e2..6e06368678f 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java
@@ -116,7 +116,7 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- assert(_exception == null && _connection == null);
+ assert(!_flushing && _exception == null && _connection == null);
_connection = connection;
_compress = compress;
}
@@ -143,18 +143,15 @@ public class ConnectRequestHandler
{
synchronized(this)
{
- assert(!_initialized && _exception == null);
+ assert(!_flushing && !_initialized && _exception == null);
_exception = ex;
- _proxies.clear();
- _proxy = null; // Break cyclic reference count.
- notifyAll();
+ _flushing = true; // Ensures request handler is removed before processing new requests.
}
//
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
+ // NOTE: remove the request handler *before* notifying the requests that the connection
+ // failed. It's important to ensure that future invocations will obtain a new connect
+ // request handler once invocations are notified.
//
try
{
@@ -173,7 +170,15 @@ public class ConnectRequestHandler
}
}
_requests.clear();
- }
+
+ synchronized(this)
+ {
+ _flushing = false;
+ _proxies.clear();
+ _proxy = null; // Break cyclic reference count.
+ notifyAll();
+ }
+ }
//
// Implementation of RouterInfo.AddProxyCallback
@@ -225,7 +230,7 @@ public class ConnectRequestHandler
// only true for a short period of time.
//
boolean interrupted = false;
- while(_flushing && _exception == null)
+ while(_flushing)
{
try
{
diff --git a/java/test/src/main/java/test/Ice/background/AllTests.java b/java/test/src/main/java/test/Ice/background/AllTests.java
index e3f6c3774ce..b7bee1f68e9 100644
--- a/java/test/src/main/java/test/Ice/background/AllTests.java
+++ b/java/test/src/main/java/test/Ice/background/AllTests.java
@@ -585,6 +585,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -611,6 +612,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -652,6 +654,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -691,6 +694,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
background.ice_getConnection().close(com.zeroc.Ice.ConnectionClose.GracefullyWithWait);
@@ -967,6 +971,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -979,6 +984,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1191,6 +1197,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1203,6 +1210,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
@@ -1245,6 +1253,7 @@ public class AllTests
}
catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}