Repository: apex-core
Updated Branches:
  refs/heads/release-3.2 15b38a1f8 -> 50db668f8


APEXCORE-538 - Log raw data when RPC message fails to de-serialize


Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/50db668f
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/50db668f
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/50db668f

Branch: refs/heads/release-3.2
Commit: 50db668f88abffae069269bfd5fe2ae5e02fc8b0
Parents: 15b38a1
Author: Vlad Rozov <v.ro...@datatorrent.com>
Authored: Thu Sep 22 09:31:32 2016 -0700
Committer: Vlad Rozov <v.ro...@datatorrent.com>
Committed: Thu Sep 22 10:07:31 2016 -0700

----------------------------------------------------------------------
 .../datatorrent/stram/util/AbstractWritableAdapter.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/apex-core/blob/50db668f/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
----------------------------------------------------------------------
diff --git 
a/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java 
b/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
index a633875..97cf11d 100644
--- 
a/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
+++ 
b/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
@@ -22,7 +22,13 @@ import java.io.*;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.hadoop.io.Writable;
 
 /**
@@ -33,6 +39,7 @@ import org.apache.hadoop.io.Writable;
 public abstract class AbstractWritableAdapter implements Writable, Serializable
 {
   private static final long serialVersionUID = 201306061421L;
+  private static final Logger logger = 
LoggerFactory.getLogger(AbstractWritableAdapter.class);
 
   @Override
   public void readFields(DataInput arg0) throws IOException
@@ -56,6 +63,9 @@ public abstract class AbstractWritableAdapter implements 
Writable, Serializable
       ois.close();
     }
     catch (Exception e) {
+      final Path path = Files.createTempFile("apex-rpc-raw-dump-", ".ser");
+      logger.error("Failed to de-serialize {}. Writing raw data to {}.", 
this.getClass().getName(), path, e);
+      Files.write(path, bytes);
       throw new IOException(e);
     }
   }

Reply via email to