# IGNITE-709 Bug Fix: don't hang discovery worker if failed to unmarshal custom 
message.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c9819825
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c9819825
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c9819825

Branch: refs/heads/ignite-23
Commit: c9819825c0ef4bc66915a464fd6d79543b39a773
Parents: b195327
Author: sevdokimov <sevdoki...@gridgain.com>
Authored: Fri May 22 17:05:47 2015 +0300
Committer: sevdokimov <sevdoki...@gridgain.com>
Committed: Fri May 22 17:05:47 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9819825/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 67a562a..0164e5c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -4533,16 +4533,26 @@ public class TcpDiscoverySpi extends 
TcpDiscoverySpiAdapter implements TcpDiscov
                 else {
                     stats.onRingMessageReceived(msg);
 
+                    DiscoverySpiCustomMessage msgObj = null;
+
                     try {
-                        DiscoverySpiCustomMessage msgObj = 
marsh.unmarshal(msg.messageBytes(), U.gridClassLoader());
+                        msgObj = marsh.unmarshal(msg.messageBytes(), 
U.gridClassLoader());
+                    }
+                    catch (Throwable e) {
+                        U.error(log, "Failed to unmarshal discovery custom 
message.", e);
+                    }
 
+                    if (msgObj != null) {
                         DiscoverySpiCustomMessage nextMsg = 
msgObj.ackMessage();
 
-                        if (nextMsg != null)
-                            addMessage(new 
TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(nextMsg)));
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(log, "Failed to unmarshal discovery custom 
message.", e);
+                        if (nextMsg != null) {
+                            try {
+                                addMessage(new 
TcpDiscoveryCustomEventMessage(getLocalNodeId(), marsh.marshal(nextMsg)));
+                            }
+                            catch (IgniteCheckedException e) {
+                                U.error(log, "Failed to marshal discovery 
custom message.", e);
+                            }
+                        }
                     }
 
                     addMessage(new 
TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id()));

Reply via email to