You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2014/12/09 23:52:15 UTC

[jira] [Commented] (SPARK-4805) BlockTransferMessage.toByteArray() trips assertion

    [ https://issues.apache.org/jira/browse/SPARK-4805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14240212#comment-14240212 ] 

Apache Spark commented on SPARK-4805:
-------------------------------------

User 'srowen' has created a pull request for this issue:
https://github.com/apache/spark/pull/3650

> BlockTransferMessage.toByteArray() trips assertion
> --------------------------------------------------
>
>                 Key: SPARK-4805
>                 URL: https://issues.apache.org/jira/browse/SPARK-4805
>             Project: Spark
>          Issue Type: Bug
>          Components: Shuffle
>    Affects Versions: 1.1.0
>            Reporter: Sean Owen
>
> The {{ByteBuf}} below is allocated to have enough room to encode just the message, but a type byte is written too. The buffer resizes and is left with capacity, which is a minor waste. But when assertions are on, it fails the assertion below. This is triggered by unit tests, but the Java test for this wasn't running. You can verify that a simple "+1" in the allocated size fixes it.
> {code}
>   public byte[] toByteArray() {
>     ByteBuf buf = Unpooled.buffer(encodedLength());
>     buf.writeByte(type().id);
>     encode(buf);
>     assert buf.writableBytes() == 0 : "Writable bytes remain: " + buf.writableBytes();
>     return buf.array();
>   }
> {code}
> [~ilikerps]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org