From 25669bf85e5f2bb3f9ba5a6c9c43e149b07095a9 Mon Sep 17 00:00:00 2001
From: ian.packer <ian.packer@forgerock.com>
Date: Mon, 30 Nov 2015 15:50:55 +0000
Subject: [PATCH] OPENDJ-2327: Improve log messages on certain 'server error' disconnects
---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java | 12 +++++++++---
opendj-server-legacy/src/messages/org/opends/messages/protocol.properties | 4 +++-
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java | 28 +++++++---------------------
3 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
index e469ab3..c45571f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -985,12 +985,18 @@
statTracker.updateMessageWritten(message);
}
}
+ catch (ClosedChannelException e)
+ {
+ logger.traceException(e);
+ disconnect(DisconnectReason.IO_ERROR, false,
+ ERR_IO_ERROR_ON_CLIENT_CONNECTION.get(getExceptionMessage(e)));
+ return;
+ }
catch (Exception e)
{
logger.traceException(e);
-
- // FIXME -- Log a message or something
- disconnect(DisconnectReason.SERVER_ERROR, false, null);
+ disconnect(DisconnectReason.SERVER_ERROR, false,
+ ERR_UNEXPECTED_EXCEPTION_ON_CLIENT_CONNECTION.get(getExceptionMessage(e)));
return;
}
finally
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java
index fce174f..3a23f1a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPRequestHandler.java
@@ -289,27 +289,13 @@
{
clientConnection = (LDAPClientConnection) key.attachment();
- try
+ int readResult = clientConnection.processDataRead();
+ if (readResult < 0)
{
- int readResult = clientConnection.processDataRead();
- if (readResult < 0)
- {
- key.cancel();
- }
- if (readResult > 0) {
- readyConnections.add(clientConnection);
- }
- }
- catch (Exception e)
- {
- logger.traceException(e);
-
- // Some other error occurred while we were trying to read data
- // from the client.
- // FIXME -- Should we log this?
key.cancel();
- clientConnection.disconnect(DisconnectReason.SERVER_ERROR,
- false, null);
+ }
+ if (readResult > 0) {
+ readyConnections.add(clientConnection);
}
}
catch (Exception e)
@@ -323,8 +309,8 @@
if (clientConnection != null)
{
- clientConnection.disconnect(DisconnectReason.SERVER_ERROR,
- false, null);
+ clientConnection.disconnect(DisconnectReason.SERVER_ERROR, false,
+ ERR_UNEXPECTED_EXCEPTION_ON_CLIENT_CONNECTION.get(getExceptionMessage(e)));
}
}
}
diff --git a/opendj-server-legacy/src/messages/org/opends/messages/protocol.properties b/opendj-server-legacy/src/messages/org/opends/messages/protocol.properties
index 92e750d..20a27e8 100644
--- a/opendj-server-legacy/src/messages/org/opends/messages/protocol.properties
+++ b/opendj-server-legacy/src/messages/org/opends/messages/protocol.properties
@@ -918,4 +918,6 @@
INFO_DISABLE_CONNECTION_1528=Disabling %s
ERR_INITIALIZE_HTTP_CONNECTION_HANDLER_1529=Failed to initialize Http Connection Handler
ERR_TRANSACTION_ID_CONTROL_HAS_NO_VALUE_1530=No value was provided for the transaction \
- id control, whereas an UTF-8 encoded value is expected
\ No newline at end of file
+ id control, whereas an UTF-8 encoded value is expected
+ERR_UNEXPECTED_EXCEPTION_ON_CLIENT_CONNECTION_1531=Exception on the underlying client connection: %s
+ERR_IO_ERROR_ON_CLIENT_CONNECTION_1532=The underlying client connection timed out or closed: %s
\ No newline at end of file
--
Gitblit v1.10.0