Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1309

Change subject: Windows 10 Logs Constant Exceptions On CC/NC Death
......................................................................

Windows 10 Logs Constant Exceptions On CC/NC Death

- Backoff delays on IPC Listener Thread exceptions; use logger instead of
  printStackTrace()

Change-Id: Iec7a3ce23ab99d04b0fc0e0f832cce1a461e2df8
---
M 
hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
1 file changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/09/1309/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
 
b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
index b03b7e0..25b7fed 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java
@@ -35,6 +35,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -71,11 +72,11 @@
         ServerSocket socket = serverSocketChannel.socket();
         socket.bind(socketAddress);
         address = new InetSocketAddress(socket.getInetAddress(), 
socket.getLocalPort());
-        ipcHandleMap = new HashMap<InetSocketAddress, IPCHandle>();
-        pendingConnections = new ArrayList<IPCHandle>();
-        workingPendingConnections = new ArrayList<IPCHandle>();
-        sendList = new ArrayList<Message>();
-        workingSendList = new ArrayList<Message>();
+        ipcHandleMap = new HashMap<>();
+        pendingConnections = new ArrayList<>();
+        workingPendingConnections = new ArrayList<>();
+        sendList = new ArrayList<>();
+        workingSendList = new ArrayList<>();
     }
 
     InetSocketAddress getAddress() {
@@ -191,7 +192,8 @@
                 throw new RuntimeException(e);
             }
             BitSet unsentMessagesBitmap = new BitSet();
-            List<Message> tempUnsentMessages = new ArrayList<Message>();
+            List<Message> tempUnsentMessages = new ArrayList<>();
+            int failingLoops = 0;
             while (!stopped) {
                 try {
                     if (LOGGER.isLoggable(Level.FINE)) {
@@ -204,7 +206,7 @@
                             SocketChannel channel = SocketChannel.open();
                             
channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
                             channel.configureBlocking(false);
-                            SelectionKey cKey = null;
+                            SelectionKey cKey;
                             if (channel.connect(handle.getRemoteAddress())) {
                                 cKey = channel.register(selector, 
SelectionKey.OP_READ);
                                 handle.setState(HandleState.CONNECT_SENT);
@@ -310,7 +312,7 @@
                                         throw new Exception("Connection did 
not finish");
                                     }
                                 } catch (Exception e) {
-                                    e.printStackTrace();
+                                    LOGGER.log(Level.WARNING, "Exception 
finishing connection", e);
                                     
handle.setState(HandleState.CONNECT_FAILED);
                                     continue;
                                 }
@@ -321,8 +323,17 @@
                             }
                         }
                     }
+                    // reset failingLoops on a good loop
+                    failingLoops = 0;
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    int sleepSecs = (int)Math.pow(2, Math.min(11, 
failingLoops++));
+                    LOGGER.log(Level.WARNING, "Exception processing message; 
sleeping " + sleepSecs
+                            + " seconds", e);
+                    try {
+                        Thread.sleep(TimeUnit.SECONDS.toMillis(sleepSecs));
+                    } catch (InterruptedException e1) {
+                        Thread.currentThread().interrupt();
+                    }
                 }
             }
         }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1309
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec7a3ce23ab99d04b0fc0e0f832cce1a461e2df8
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to