nemo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeongy...@apache.org
Subject [incubator-nemo] 39/40: fixed?
Date Fri, 06 Apr 2018 02:36:19 GMT
This is an automated email from the ASF dual-hosted git repository.

jeongyoon pushed a commit to branch skew_exp
in repository https://gitbox.apache.org/repos/asf/incubator-nemo.git

commit cf3b31e0ec8308ee359fff4b95c1bcecb8e6ec05
Author: sanha <sanhaleehana@naver.com>
AuthorDate: Sun Mar 25 00:31:04 2018 +0900

    fixed?
---
 .../runtime/executor/bytetransfer/DataFrameEncoder.java     | 13 ++++++++++++-
 .../nemo/runtime/executor/bytetransfer/FrameDecoder.java    | 12 ++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/DataFrameEncoder.java
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/DataFrameEncoder.java
index af4f604..3074dce 100644
--- a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/DataFrameEncoder.java
+++ b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/DataFrameEncoder.java
@@ -21,6 +21,8 @@ import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.MessageToMessageEncoder;
 import io.netty.util.Recycler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
 import javax.inject.Inject;
@@ -34,8 +36,10 @@ import java.util.List;
 @ChannelHandler.Sharable
 final class DataFrameEncoder extends MessageToMessageEncoder<DataFrameEncoder.DataFrame>
{
 
+  private static final Logger LOG = LoggerFactory.getLogger(DataFrameEncoder.class.getName());
   private static final int TRANSFER_INDEX_LENGTH = Integer.BYTES;
   private static final int BODY_LENGTH_LENGTH = Integer.BYTES;
+  //private static final int BODY_LENGTH_LENGTH = Long.BYTES;
   private static final int HEADER_LENGTH = Byte.BYTES + TRANSFER_INDEX_LENGTH + BODY_LENGTH_LENGTH;
 
   // the maximum length of a frame body. 2**32 - 1
@@ -65,8 +69,15 @@ final class DataFrameEncoder extends MessageToMessageEncoder<DataFrameEncoder.Da
     header.writeInt(in.contextId.getTransferIndex());
 
     // in.length should not exceed the range of unsigned int
-    assert (in.length <= LENGTH_MAX);
+    if (in.length > LENGTH_MAX) {
+      LOG.error("@@@@ data frame to send length is greater than long max!");
+      throw new RuntimeException("@@@@ data frame to send length is greater than long max!");
+    } else if (in.length > (long) Integer.MAX_VALUE) {
+      LOG.error("@@@@ data frame to send length is greater than int max!");
+      throw new RuntimeException("@@@@ data frame to send length is greater than int max!");
+    }
     header.writeInt((int) in.length);
+    //header.writeLong(in.length);
 
     out.add(header);
 
diff --git a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
index 57affc5..d5ac35c 100644
--- a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
+++ b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
@@ -55,7 +55,8 @@ import java.util.List;
  *   <---------------------------------- HEADER --------------------------------------------------->
<----- BODY ----->
  *   +-------+-------+-------------------+------------------+---------------+-------------+---------+-------...-------+
  *   | Zeros |   1   | DataDirectionFlag | NewSubStreamFlag | LastFrameFlag | TransferIdx
| Length  |       Body      |
- *   | 4 bit | 1 bit |       1 bit       |      1 bit       |     1 bit     |   4 bytes 
 | 4 bytes | Variable length |
+ *   | 4 bit | 1 bit |       1 bit       |      1 bit       |     1 bit     |   4 bytes 
 | 4 bytes | Variable length |X
+ *   | 4 bit | 1 bit |       1 bit       |      1 bit       |     1 bit     |   4 bytes 
 | 8 bytes | Variable length |
  *   +-------+-------+-------------------+------------------+---------------+-------------+---------+-------...-------+
  * }
  * </pre>
@@ -65,6 +66,7 @@ import java.util.List;
 final class FrameDecoder extends ByteToMessageDecoder {
   private static final Logger LOG = LoggerFactory.getLogger(FrameDecoder.class.getName());
   private static final int HEADER_LENGTH = 9;
+  //private static final int HEADER_LENGTH = 13;
 
   private final ContextManager contextManager;
 
@@ -132,12 +134,14 @@ final class FrameDecoder extends ByteToMessageDecoder {
     final byte flags = in.readByte();
     final int transferIndex = in.readInt();
     final long length = in.readUnsignedInt();
+    //final long length = in.readLong();
+    LOG.debug("@@@@ frame length " + length);
     if (length < 0) {
       throw new IllegalStateException(String.format("Frame length is negative: %d", length));
-    } else if (length > (long) Integer.MAX_VALUE) {
-      LOG.error("@@@@ frame length greater than int max!");
+    } /*else if (length > (long) Integer.MAX_VALUE) {
+      LOG.error("@@@@ frame length " + length + " is greater than int max!");
       throw new RuntimeException("@@@@ frame length greater than int max!");
-    }
+    }*/
     if ((flags & ((byte) (1 << 3))) == 0) {
       // setup context for reading control frame body
       controlBodyBytesToRead = length;

-- 
To stop receiving notification emails like this one, please contact
jeongyoon@apache.org.

Mime
View raw message