Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Motsch2019-03-19 15:35:17 +0000
committerIvan Motsch2019-03-20 14:14:14 +0000
commit5a0a15a802e52b0927e9b7ce739197230f68d356 (patch)
tree87e914df97f49ca7103d59a5851d29194ee93db1 /org.eclipse.scout.rt.server.test
parentf053def7e68d544b3438c2ffc8a3fccad32139bd (diff)
downloadorg.eclipse.scout.rt-5a0a15a802e52b0927e9b7ce739197230f68d356.tar.gz
org.eclipse.scout.rt-5a0a15a802e52b0927e9b7ce739197230f68d356.tar.xz
org.eclipse.scout.rt-5a0a15a802e52b0927e9b7ce739197230f68d356.zip
Fix for issue 'NoHttpResponseException
When a socket channel in the server side gets stale, which is rare but possible, then a NoHttpResponseException can occur even if connection check on the server side is done in millisecond interval. http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e659 This patch fixes that issue by performing a one-time request retry upon occurrence of a typical exception in such a situation. Two config.properties control the use of that feature: name: scout.http.retryOnNoHttpResponseException default value: true class: ApacheHttpTransportRetryOnNoHttpResponseExceptionProperty name: scout.http.retryOnSocketExceptionByConnectionReset default value: true class: ApacheHttpTransportRetryOnSocketExceptionByConnectionResetProperty Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com> custChange-Id: I0000000000000000000000000000000000000000 Reviewed-on: https://git.eclipse.org/r/139040 Tested-by: CI Bot Reviewed-by: Ivan Motsch <ivan.motsch@bsiag.com> Change-Id: I14bda8093ba749bd11a423f16cea52e28d04ca62 Reviewed-on: https://git.eclipse.org/r/139116 Reviewed-on: https://git.eclipse.org/r/139122
Diffstat (limited to 'org.eclipse.scout.rt.server.test')
-rw-r--r--org.eclipse.scout.rt.server.test/src/test/java/org/eclipse/scout/rt/server/commons/http/HttpRetryTest.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.scout.rt.server.test/src/test/java/org/eclipse/scout/rt/server/commons/http/HttpRetryTest.java b/org.eclipse.scout.rt.server.test/src/test/java/org/eclipse/scout/rt/server/commons/http/HttpRetryTest.java
index 9b383954c4..8f2bbb03b9 100644
--- a/org.eclipse.scout.rt.server.test/src/test/java/org/eclipse/scout/rt/server/commons/http/HttpRetryTest.java
+++ b/org.eclipse.scout.rt.server.test/src/test/java/org/eclipse/scout/rt/server/commons/http/HttpRetryTest.java
@@ -259,8 +259,9 @@ public class HttpRetryTest {
//emulate a socket close before data is received
AtomicInteger count = new AtomicInteger(1);
m_server.withChannelInterceptor((channel, superCall) -> {
- if (count.getAndIncrement() < 2) {
- channel.getHttpTransport().abort(new SocketException("TEST:cannot write"));
+ //2 failures in a row, the first would have been retried by the CustomHttpRequestRetryHandler
+ if (count.getAndIncrement() < 3) {
+ channel.getHttpTransport().abort(new IOException("TEST:cannot write"));
return;
}
superCall.call();

Back to the top