summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2019-07-18 18:09:15 +0200
committerGitHub <noreply@github.com>2019-07-18 18:09:15 +0200
commit2c036ca6ca7f39b6987135839a1a899cd080877d (patch)
tree71b429a5784a77ec41084ba84105930f537f195e /cpp/test/Ice/interceptor/AMDInterceptorI.cpp
parentBumped invocation timeout in Objectice-C timeout test (diff)
downloadice-2c036ca6ca7f39b6987135839a1a899cd080877d.tar.bz2
ice-2c036ca6ca7f39b6987135839a1a899cd080877d.tar.xz
ice-2c036ca6ca7f39b6987135839a1a899cd080877d.zip
Fixed non-thread safe AMD dispatch, fixes #448 (#449)
The caching of the output stream which was added back to solve #414 made the dispatch of AMD requests non thread-safe if a dispatch interceptor was installed and if the interceptor retried the dispatch. Multiple continuation could run concurrently and eventually re-use the cached output stream to marshal multiple responses.
Diffstat (limited to 'cpp/test/Ice/interceptor/AMDInterceptorI.cpp')
-rw-r--r--cpp/test/Ice/interceptor/AMDInterceptorI.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
index e2e2d95b001..158cf2736fa 100644
--- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
+++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
@@ -103,6 +103,15 @@ AMDInterceptorI::dispatch(Ice::Request& request)
current.ctx["retry"] = "no";
}
+ else if(current.ctx.find("retry") != current.ctx.end() && current.ctx["retry"] == "yes")
+ {
+ //
+ // Retry the dispatch to ensure that abandoning the result of the dispatch
+ // works fine and is thread-safe
+ //
+ _servant->ice_dispatch(request);
+ _servant->ice_dispatch(request);
+ }
#ifdef ICE_CPP11_MAPPING
_lastStatus = _servant->ice_dispatch(request, []() { return true; }, [this](exception_ptr ex) {