diff options
author | Benoit Foucher <benoit@zeroc.com> | 2013-01-07 16:20:00 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2013-01-07 16:20:00 +0100 |
commit | f68bda81245047d672879dbb90e55b4446ffa71b (patch) | |
tree | 4334915e140af70af74f1d8b2a32eba6bf97f57f | |
parent | Added missing RemoteObserverI.java file (diff) | |
download | ice-f68bda81245047d672879dbb90e55b4446ffa71b.tar.bz2 ice-f68bda81245047d672879dbb90e55b4446ffa71b.tar.xz ice-f68bda81245047d672879dbb90e55b4446ffa71b.zip |
Fixed ICE-5150: assert in OutgoingAsync._finished, fixed CHANGES
29 files changed, 238 insertions, 5 deletions
@@ -27,6 +27,32 @@ Changes since version 3.5b General Changes =============== +- Fixed bug where the retry of an AMI invocation could trigger an + assertion. + +- Improved the dispatch and remote invocation metrics classes to + support additional size and replySize data members. + +- Improved the 1.1 encoding to reduce further more the size of encoded + objects. Objects are no longer encoded at the end of the + encapsulation. Instead, an object is encoded as soon as it's written + and it hasn't already been encoded within the encapsulation. + + IMPORTANT: This change implies that the 1.1 class encoding from Ice + 3.5.0 is incompatible with the encoding from the 3.5 beta version. + +- Added support for Slice class compact IDs. A compact ID is defined + as a numeric value in the Slice class definition. For example: + + // Slice + class Compact(1) + { + string v; + }; + + When using the 1.1 encoding, Ice will transmit this numerical value + instead of the string type ID of the class. + - Fixed bugs in the Slice parser related to optional values: * The parser was too strict when validating tags of optional data diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 71b55d05b14..df643ae4112 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -283,7 +283,7 @@ Slice::Builtin::minWireSize() const 4, // KindFloat 8, // KindDouble 1, // KindString: at least one byte for an empty string. - 1, // KindObject: at least 4 bytes (to marshal an index instead of an instance). + 1, // KindObject: at least one byte (to marshal an index instead of an instance). 2 // KindObjectProxy: at least an empty identity for a nil proxy, that is, 2 bytes. }; diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index d08c104e2db..d9033a0f76a 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -841,6 +841,9 @@ public: catch(const Ice::UnknownLocalException&) { } + catch(const Ice::OperationNotExistException&) + { + } catch(...) { test(false); @@ -1416,6 +1419,21 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { test(false); } + try + { + thrower->throwLocalExceptionIdempotent(); + test(false); + } + catch(const Ice::UnknownLocalException&) + { + } + catch(const Ice::OperationNotExistException&) + { + } + catch(...) + { + test(false); + } cout << "ok" << endl; @@ -1770,6 +1788,15 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) cb->check(); } + { + CallbackPtr cb = new Callback; + Callback_Thrower_throwLocalExceptionIdempotentPtr callback = + newCallback_Thrower_throwLocalExceptionIdempotent(cb, &Callback::response, + &Callback::exception_LocalException); + thrower->begin_throwLocalExceptionIdempotent(callback); + cb->check(); + } + cout << "ok" << endl; cout << "catching unknown non-Ice exception with new AMI mapping... " << flush; diff --git a/cpp/test/Ice/exceptions/Test.ice b/cpp/test/Ice/exceptions/Test.ice index 5338dac2414..895e99894b6 100644 --- a/cpp/test/Ice/exceptions/Test.ice +++ b/cpp/test/Ice/exceptions/Test.ice @@ -91,6 +91,8 @@ module Mod void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/cpp/test/Ice/exceptions/TestAMD.ice b/cpp/test/Ice/exceptions/TestAMD.ice index a5c4353e65b..ee03c14449b 100644 --- a/cpp/test/Ice/exceptions/TestAMD.ice +++ b/cpp/test/Ice/exceptions/TestAMD.ice @@ -92,6 +92,8 @@ module Mod void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp index 266f020fc4e..b701658ee80 100644 --- a/cpp/test/Ice/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/exceptions/TestAMDI.cpp @@ -196,6 +196,13 @@ ThrowerI::throwAssertException_async(const AMD_Thrower_throwAssertExceptionPtr&, } void +ThrowerI::throwLocalExceptionIdempotent_async(const AMD_Thrower_throwLocalExceptionIdempotentPtr& cb, + const Ice::Current&) +{ + cb->ice_exception(Ice::TimeoutException(__FILE__, __LINE__)); +} + +void ThrowerI::throwAfterResponse_async(const AMD_Thrower_throwAfterResponsePtr& cb, const Ice::Current&) { cb->ice_response(); diff --git a/cpp/test/Ice/exceptions/TestAMDI.h b/cpp/test/Ice/exceptions/TestAMDI.h index 3143d44ab61..8e7e79294b0 100644 --- a/cpp/test/Ice/exceptions/TestAMDI.h +++ b/cpp/test/Ice/exceptions/TestAMDI.h @@ -59,6 +59,9 @@ public: virtual void throwAssertException_async(const Test::AMD_Thrower_throwAssertExceptionPtr&, const Ice::Current&); + virtual void throwLocalExceptionIdempotent_async(const Test::AMD_Thrower_throwLocalExceptionIdempotentPtr&, + const Ice::Current&); + virtual void throwAfterResponse_async(const Test::AMD_Thrower_throwAfterResponsePtr&, const Ice::Current&); virtual void throwAfterException_async(const Test::AMD_Thrower_throwAfterExceptionPtr&, const Ice::Current&); diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp index 56797a7c5c7..bf65bfd72ae 100644 --- a/cpp/test/Ice/exceptions/TestI.cpp +++ b/cpp/test/Ice/exceptions/TestI.cpp @@ -153,6 +153,12 @@ ThrowerI::throwAssertException(const Ice::Current&) } void +ThrowerI::throwLocalExceptionIdempotent(const Ice::Current&) +{ + throw Ice::TimeoutException(__FILE__, __LINE__); +} + +void ThrowerI::throwAfterResponse(const Ice::Current&) { // diff --git a/cpp/test/Ice/exceptions/TestI.h b/cpp/test/Ice/exceptions/TestI.h index cd8c2121a89..731c16bcf9e 100644 --- a/cpp/test/Ice/exceptions/TestI.h +++ b/cpp/test/Ice/exceptions/TestI.h @@ -41,6 +41,8 @@ public: virtual void throwNonIceException(const Ice::Current&); virtual void throwAssertException(const Ice::Current&); + virtual void throwLocalExceptionIdempotent(const Ice::Current&); + virtual void throwAfterResponse(const Ice::Current&); virtual void throwAfterException(const Ice::Current&); }; diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index d8eb610bc17..d4ad74c8197 100644 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -1040,8 +1040,10 @@ namespace IceInternal _timerTask = null; } - Debug.Assert(is_ == null); - is_ = new IceInternal.BasicStream(instance_, Ice.Util.currentProtocolEncoding); + if(is_ == null) // _is can already be initialized if the invocation is retried + { + is_ = new IceInternal.BasicStream(instance_, Ice.Util.currentProtocolEncoding); + } is_.swap(istr); replyStatus = is_.readByte(); diff --git a/cs/test/Ice/exceptions/AllTests.cs b/cs/test/Ice/exceptions/AllTests.cs index ddca73db90f..8fb040769ae 100644 --- a/cs/test/Ice/exceptions/AllTests.cs +++ b/cs/test/Ice/exceptions/AllTests.cs @@ -921,6 +921,9 @@ public class AllTests : TestCommon.TestApp catch(Ice.UnknownLocalException) { } + catch(Ice.OperationNotExistException) + { + } catch(Exception) { test(false); @@ -1386,6 +1389,21 @@ public class AllTests : TestCommon.TestApp { test(false); } + try + { + thrower.throwLocalExceptionIdempotent(); + test(false); + } + catch(Ice.UnknownLocalException) + { + } + catch(Ice.OperationNotExistException) + { + } + catch(Exception) + { + test(false); + } WriteLine("ok"); @@ -1714,6 +1732,12 @@ public class AllTests : TestCommon.TestApp cb3.check(); } + { + AsyncCallback cb3 = new AsyncCallback(); + thrower.begin_throwLocalExceptionIdempotent().whenCompleted(cb3.response, cb3.exception_LocalException); + cb3.check(); + } + WriteLine("ok"); Write("catching unknown non-Ice exception with new AMI mapping... "); diff --git a/cs/test/Ice/exceptions/Test.ice b/cs/test/Ice/exceptions/Test.ice index 9315039c3d0..2883d26d0c5 100644 --- a/cs/test/Ice/exceptions/Test.ice +++ b/cs/test/Ice/exceptions/Test.ice @@ -58,6 +58,8 @@ exception D void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/cs/test/Ice/exceptions/TestAMD.ice b/cs/test/Ice/exceptions/TestAMD.ice index 2b59400e385..d1b048eb5b2 100644 --- a/cs/test/Ice/exceptions/TestAMD.ice +++ b/cs/test/Ice/exceptions/TestAMD.ice @@ -58,6 +58,8 @@ exception D void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/cs/test/Ice/exceptions/ThrowerAMDI.cs b/cs/test/Ice/exceptions/ThrowerAMDI.cs index 069e6da98a7..6699b823df9 100644 --- a/cs/test/Ice/exceptions/ThrowerAMDI.cs +++ b/cs/test/Ice/exceptions/ThrowerAMDI.cs @@ -139,6 +139,12 @@ public class ThrowerI : ThrowerDisp_ Debug.Assert(false); } + public override void throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent e, + Ice.Current current) + { + throw new Ice.TimeoutException(); + } + public override void throwAfterResponse_async(AMD_Thrower_throwAfterResponse cb, Ice.Current current) { cb.ice_response(); diff --git a/cs/test/Ice/exceptions/ThrowerI.cs b/cs/test/Ice/exceptions/ThrowerI.cs index fa8e77424c6..a780625fa97 100644 --- a/cs/test/Ice/exceptions/ThrowerI.cs +++ b/cs/test/Ice/exceptions/ThrowerI.cs @@ -102,6 +102,11 @@ public sealed class ThrowerI : ThrowerDisp_ Debug.Assert(false); } + public override void throwLocalExceptionIdempotent(Ice.Current current) + { + throw new Ice.TimeoutException(); + } + public override void throwUndeclaredA(int a, Ice.Current current) { A ex = new A(); diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index e1e9beee974..b2b66a3be88 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -241,8 +241,10 @@ public class OutgoingAsync extends Ice.AsyncResult implements OutgoingAsyncMessa _timerTask = null; } - assert _is == null; - _is = new IceInternal.BasicStream(_instance, IceInternal.Protocol.currentProtocolEncoding); + if(_is == null) // _is can already be initialized if the invocation is retried + { + _is = new IceInternal.BasicStream(_instance, IceInternal.Protocol.currentProtocolEncoding); + } _is.swap(is); replyStatus = _is.readByte(); diff --git a/java/test/Ice/exceptions/AMDThrowerI.java b/java/test/Ice/exceptions/AMDThrowerI.java index 5b67f4ed442..3f0c04c6ec0 100644 --- a/java/test/Ice/exceptions/AMDThrowerI.java +++ b/java/test/Ice/exceptions/AMDThrowerI.java @@ -22,6 +22,7 @@ import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasA; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasB; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasC; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalException; +import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalExceptionIdempotent; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwNonIceException; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredA; import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredB; @@ -188,6 +189,12 @@ public final class AMDThrowerI extends _ThrowerDisp } public void + throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent cb, Ice.Current current) + { + cb.ice_exception(new Ice.TimeoutException()); + } + + public void throwAfterResponse_async(AMD_Thrower_throwAfterResponse cb, Ice.Current current) { cb.ice_response(); diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java index 801ab5addde..d15c956ab79 100644 --- a/java/test/Ice/exceptions/AllTests.java +++ b/java/test/Ice/exceptions/AllTests.java @@ -21,6 +21,7 @@ import test.Ice.exceptions.Test.AMI_Thrower_throwCasA; import test.Ice.exceptions.Test.AMI_Thrower_throwCasB; import test.Ice.exceptions.Test.AMI_Thrower_throwCasC; import test.Ice.exceptions.Test.AMI_Thrower_throwLocalException; +import test.Ice.exceptions.Test.AMI_Thrower_throwLocalExceptionIdempotent; import test.Ice.exceptions.Test.AMI_Thrower_throwNonIceException; import test.Ice.exceptions.Test.AMI_Thrower_throwUndeclaredA; import test.Ice.exceptions.Test.AMI_Thrower_throwUndeclaredB; @@ -42,6 +43,7 @@ import test.Ice.exceptions.Test.Callback_Thrower_throwCasA; import test.Ice.exceptions.Test.Callback_Thrower_throwCasB; import test.Ice.exceptions.Test.Callback_Thrower_throwCasC; import test.Ice.exceptions.Test.Callback_Thrower_throwLocalException; +import test.Ice.exceptions.Test.Callback_Thrower_throwLocalExceptionIdempotent; import test.Ice.exceptions.Test.Callback_Thrower_throwNonIceException; import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredA; import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredB; @@ -1245,6 +1247,9 @@ public class AllTests catch(Ice.UnknownLocalException ex) { } + catch(Ice.OperationNotExistException ex) + { + } catch(Throwable ex) { ex.printStackTrace(); @@ -1820,6 +1825,23 @@ public class AllTests test(false); } + try + { + thrower.throwLocalExceptionIdempotent(); + test(false); + } + catch(Ice.UnknownLocalException ex) + { + } + catch(Ice.OperationNotExistException ex) + { + } + catch(Throwable ex) + { + ex.printStackTrace(); + test(false); + } + out.println("ok"); out.print("catching unknown non-Ice exception... "); @@ -2179,6 +2201,25 @@ public class AllTests cb.check(); } + { + final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI(); + thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent() + { + @Override + public void response() + { + cb.response(); + } + + @Override + public void exception(Ice.LocalException exc) + { + cb.exception(exc); + } + }); + cb.check(); + } + out.println("ok"); out.print("catching unknown non-Ice exception with new AMI mapping... "); diff --git a/java/test/Ice/exceptions/Test.ice b/java/test/Ice/exceptions/Test.ice index ec93564a599..18d61ec8ccf 100644 --- a/java/test/Ice/exceptions/Test.ice +++ b/java/test/Ice/exceptions/Test.ice @@ -60,6 +60,8 @@ exception D void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/java/test/Ice/exceptions/TestAMD.ice b/java/test/Ice/exceptions/TestAMD.ice index 3cf7b850e77..aa7a3aa3c32 100644 --- a/java/test/Ice/exceptions/TestAMD.ice +++ b/java/test/Ice/exceptions/TestAMD.ice @@ -55,6 +55,8 @@ exception D void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/java/test/Ice/exceptions/ThrowerI.java b/java/test/Ice/exceptions/ThrowerI.java index fab7640b0eb..5ca5e735006 100644 --- a/java/test/Ice/exceptions/ThrowerI.java +++ b/java/test/Ice/exceptions/ThrowerI.java @@ -138,6 +138,12 @@ public final class ThrowerI extends _ThrowerDisp } public void + throwLocalExceptionIdempotent(Ice.Current current) + { + throw new Ice.TimeoutException(); + } + + public void throwNonIceException(Ice.Current current) { throw new RuntimeException(); diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php index 351a2bb5790..0b6c10ec922 100644 --- a/php/test/Ice/exceptions/Client.php +++ b/php/test/Ice/exceptions/Client.php @@ -354,6 +354,21 @@ function allTests($communicator) } } + try + { + $thrower->throwLocalExceptionIdempotent(); + test(false); + } + catch(Exception $ex) + { + $ule = $NS ? "Ice\\UnknownLocalException" : "Ice_UnknownLocalException"; + $one = $NS ? "Ice\\OperationNotExistException" : "Ice_OperationNotExistException"; + if(!($ex instanceof $ule) && !($ex instanceof $one)) + { + throw $ex; + } + } + echo "ok\n"; echo "catching unknown non-Ice exception... "; diff --git a/php/test/Ice/exceptions/Test.ice b/php/test/Ice/exceptions/Test.ice index a2d04ae66df..c2c214ffa14 100644 --- a/php/test/Ice/exceptions/Test.ice +++ b/php/test/Ice/exceptions/Test.ice @@ -55,6 +55,8 @@ exception D void throwUndeclaredC(int a, int b, int c); void throwLocalException(); void throwNonIceException(); + + idempotent void throwLocalExceptionIdempotent(); }; ["ami"] interface WrongOperation diff --git a/py/test/Ice/exceptions/AllTests.py b/py/test/Ice/exceptions/AllTests.py index 2e203eeed8e..1957b647c70 100644 --- a/py/test/Ice/exceptions/AllTests.py +++ b/py/test/Ice/exceptions/AllTests.py @@ -434,6 +434,8 @@ class Callback(CallbackBase): raise ex except Ice.UnknownLocalException as ex: pass + except Ice.OperationNotExistException as ex: + pass except: test(False) self.called() @@ -745,6 +747,16 @@ def allTests(communicator): except: print(sys.exc_info()) test(False) + try: + thrower.throwLocalExceptionIdempotent() + test(False) + except Ice.UnknownLocalException: + pass + except Ice.OperationNotExistException: + pass + except: + print(sys.exc_info()) + test(False) print("ok") @@ -1002,6 +1014,10 @@ def allTests(communicator): thrower.begin_throwLocalException(cb.response, cb.exception_LocalException) cb.check() + cb = Callback() + thrower.begin_throwLocalExceptionIdempotent(cb.response, cb.exception_LocalException) + cb.check() + print("ok") sys.stdout.write("catching unknown non-Ice exception with new AMI mapping... ") diff --git a/py/test/Ice/exceptions/ServerAMD.py b/py/test/Ice/exceptions/ServerAMD.py index 61b8a7e717c..a11a54f0c23 100755 --- a/py/test/Ice/exceptions/ServerAMD.py +++ b/py/test/Ice/exceptions/ServerAMD.py @@ -109,6 +109,9 @@ class ThrowerI(Test.Thrower): def throwAssertException_async(self, cb, current=None): raise RuntimeError("operation `throwAssertException' not supported") + def throwLocalExceptionIdempotent_async(self, cb, current=None): + cb.ice_exception(Ice.TimeoutException()) + def throwAfterResponse_async(self, cb, current=None): cb.ice_response() raise RuntimeError("12345") diff --git a/py/test/Ice/exceptions/Test.ice b/py/test/Ice/exceptions/Test.ice index 61cd21cc6d1..3ffe3930967 100644 --- a/py/test/Ice/exceptions/Test.ice +++ b/py/test/Ice/exceptions/Test.ice @@ -69,6 +69,8 @@ module Mod void throwNonIceException(); void throwAssertException(); + idempotent void throwLocalExceptionIdempotent(); + void throwAfterResponse(); void throwAfterException() throws A; }; diff --git a/py/test/Ice/exceptions/TestI.py b/py/test/Ice/exceptions/TestI.py index 1fd6ea2634d..107cb23afd1 100644 --- a/py/test/Ice/exceptions/TestI.py +++ b/py/test/Ice/exceptions/TestI.py @@ -89,6 +89,9 @@ class ThrowerI(Test.Thrower): def throwAssertException(self, current=None): raise RuntimeError("operation `throwAssertException' not supported") + def throwLocalExceptionIdempotent(self, current=None): + raise Ice.TimeoutException() + def throwAfterResponse(self, current=None): # # Only relevant for AMD. diff --git a/rb/test/Ice/exceptions/AllTests.rb b/rb/test/Ice/exceptions/AllTests.rb index 34691788d64..ebfab60040b 100644 --- a/rb/test/Ice/exceptions/AllTests.rb +++ b/rb/test/Ice/exceptions/AllTests.rb @@ -332,6 +332,20 @@ def allTests(communicator) test(false) end + begin + thrower.throwLocalExceptionIdempotent() + test(false) + rescue Ice::UnknownLocalException + # + # We get an unknown local exception without collocation + # optimization. + # + rescue Ice::OperationNotExistException + rescue + print $!.backtrace.join("\n") + test(false) + end + puts "ok" print "catching unknown non-Ice exception... " diff --git a/rb/test/Ice/exceptions/Test.ice b/rb/test/Ice/exceptions/Test.ice index 5fbc2e73445..f8a4fda8405 100644 --- a/rb/test/Ice/exceptions/Test.ice +++ b/rb/test/Ice/exceptions/Test.ice @@ -69,6 +69,8 @@ module Mod void throwLocalException(); void throwNonIceException(); void throwAssertException(); + + idempotent void throwLocalExceptionIdempotent(); }; ["ami"] interface WrongOperation |