diff --git a/ChangeLog.md b/ChangeLog.md index beb71c127..4b5b5b568 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +- fixed retry behavior of HTTP connections in case of timeout exceptions + ## [6.16.0] - 2022-01-27 - deprecated hash and skiplist indexes (#424) diff --git a/pom.xml b/pom.xml index 2796bc1c4..52cb40be5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.arangodb arangodb-java-driver - 6.16.0 + 6.16.1-SNAPSHOT 2016 jar diff --git a/src/main/java/com/arangodb/internal/http/HttpCommunication.java b/src/main/java/com/arangodb/internal/http/HttpCommunication.java index 5468bbbbb..dcb840ce1 100644 --- a/src/main/java/com/arangodb/internal/http/HttpCommunication.java +++ b/src/main/java/com/arangodb/internal/http/HttpCommunication.java @@ -32,6 +32,8 @@ import java.io.Closeable; import java.io.IOException; +import java.net.SocketTimeoutException; +import java.util.concurrent.TimeoutException; /** * @author Mark Vollmary @@ -85,6 +87,13 @@ private Response execute(final Request request, final HostHandle hostHandle, fin hostHandler.success(); hostHandler.confirm(); return response; + } catch (final SocketTimeoutException e) { + // SocketTimeoutException exceptions are wrapped and rethrown. + // Differently from other IOException exceptions they must not be retried, + // since the requests could not be idempotent. + TimeoutException te = new TimeoutException(e.getMessage()); + te.initCause(e); + throw new ArangoDBException(te); } catch (final IOException e) { hostHandler.fail(e); if (hostHandle != null && hostHandle.getHost() != null) {