You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by do...@apache.org on 2021/01/29 17:27:57 UTC
[geode] branch support/1.12 updated: GEODE-8873: Do not log stack
trace for Exception in MessageDispatcher
This is an automated email from the ASF dual-hosted git repository.
donalevans pushed a commit to branch support/1.12
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/support/1.12 by this push:
new df07af4 GEODE-8873: Do not log stack trace for Exception in MessageDispatcher
df07af4 is described below
commit df07af4c2e27c384b56c78e721c8f8e3e0e61c3f
Author: Donal Evans <do...@vmware.com>
AuthorDate: Mon Jan 25 16:39:43 2021 -0800
GEODE-8873: Do not log stack trace for Exception in MessageDispatcher
Authored-by: Donal Evans <do...@vmware.com>
(cherry picked from commit 07389149efad9aff18da888b1828639468a884b5)
---
.../cache/tier/sockets/CacheClientProxy.java | 52 ++++++++--------------
1 file changed, 19 insertions(+), 33 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index c7f14f0..90bac44 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -18,6 +18,7 @@ import java.io.IOException;
import java.net.Socket;
import java.net.SocketException;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
@@ -2573,13 +2574,13 @@ public class CacheClientProxy implements ClientSession {
}
// Processing gets here if isStopped=true. What is this code below doing?
- List list = null;
if (!exceptionOccurred) {
+ List<ClientMessage> list = new ArrayList<>();
try {
// Clear the interrupt status if any,
Thread.interrupted();
- int size = this._messageQueue.size();
- list = this._messageQueue.peek(size);
+ int size = _messageQueue.size();
+ list.addAll(_messageQueue.peek(size));
if (logger.isDebugEnabled()) {
logger.debug(
"{}: After flagging the dispatcher to stop , the residual List of messages to be dispatched={} size={}",
@@ -2587,53 +2588,38 @@ public class CacheClientProxy implements ClientSession {
}
if (list.size() > 0) {
long start = getStatistics().startTime();
- Iterator itr = list.iterator();
+ Iterator<ClientMessage> itr = list.iterator();
while (itr.hasNext()) {
- dispatchMessage((ClientMessage) itr.next());
+ dispatchMessage(itr.next());
getStatistics().endMessage(start);
- // @todo asif: shouldn't we call itr.remove() since the current msg
- // has been sent? That way list will be more accurate
- // if we have an exception.
+ itr.remove();
}
- this._messageQueue.remove();
+ _messageQueue.remove();
}
} catch (CancelException e) {
if (logger.isDebugEnabled()) {
logger.debug("CacheClientNotifier stopped due to cancellation");
}
- } catch (Exception ignore) {
- // if (logger.isInfoEnabled()) {
+ } catch (Exception e) {
String extraMsg = null;
- if ("Broken pipe".equals(ignore.getMessage())) {
+ if ("Broken pipe".equals(e.getMessage())) {
extraMsg = "Problem caused by broken pipe on socket.";
- } else if (ignore instanceof RegionDestroyedException) {
- extraMsg =
- "Problem caused by message queue being closed.";
+ } else if (e instanceof RegionDestroyedException) {
+ extraMsg = "Problem caused by message queue being closed.";
}
- final Object[] msgArgs = new Object[] {((!isStopped()) ? this.toString() + ": " : ""),
- ((list == null) ? 0 : list.size())};
- if (extraMsg != null) {
- // Dont print exception details, but add on extraMsg
- logger.info(
- String.format(
- "%s Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list %s.",
- msgArgs));
- logger.info(extraMsg);
- } else {
- // Print full stacktrace
- logger.info(String.format(
- "%s Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list %s.",
- msgArgs),
- ignore);
+ if (extraMsg == null) {
+ extraMsg = "Problem caused by: " + e.getMessage();
}
+ logger.info(String.format(
+ "%s Possibility of not being able to send some or all of the messages to clients. Total messages currently present in the list %s.",
+ (!isStopped()) ? toString() + ": " : "", list.size()));
+ logger.info(extraMsg);
}
- if (list != null && logger.isTraceEnabled()) {
+ if (!list.isEmpty() && logger.isTraceEnabled()) {
logger.trace("Messages remaining in the list are: {}", list);
}
-
- // }
}
if (logger.isTraceEnabled()) {
logger.trace("{}: Dispatcher thread is ending", this);