summaryrefslogtreecommitdiffstats
path: root/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java')
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
index 1764016bae6..b931a7f2617 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java
@@ -347,11 +347,16 @@ public class IOThread implements Runnable, AutoCloseable {
currentConnection.handshake();
successfulHandshakes.getAndIncrement();
} catch (ServerResponseException ser) {
+ int code = ser.getResponseCode();
+ if (code == 401 || code == 403) {
+ drainDocumentQueueWhenFailingPermanently(new Exception("Denied access by endpoint:" + ser.getResponseString()));
+ log.log(Level.SEVERE, "Failed authentication or authorization with '" + endpoint + "': " + Exceptions.toMessageString(ser));
+ return ConnectionState.CONNECTED; // Should ideally exit immediately, instead of doing this per X documents :/
+ }
executeProblemsCounter.incrementAndGet();
log.log(Level.INFO, "Failed talking to endpoint. Handshake with server endpoint '" + endpoint +
- "' failed. Will re-try handshake.",
- ser);
+ "' failed -- will re-try handshake: " + Exceptions.toMessageString(ser));
drainFirstDocumentsInQueueIfOld();
resultQueue.onEndpointError(new FeedProtocolException(ser.getResponseCode(), ser.getResponseString(), ser, endpoint));