Spark and Java: Exception thrown in awaitResult

It turned out that I had Spark version 1.5.2 running in the virtual machine and used version 2.0.1 of the Spark library in Java. I fixed the issue by using the appropriate Spark library version in my pom.xml which is

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.10</artifactId>
    <version>1.5.2</version>
</dependency>

Another problem (that occurred later) was, that I also had to pin the Scala version with which the library was build. This is the _2.10 suffix in the artifactId.

Basically @RamPrassad's answer pointed me into the right direction but didn't give a clear advice what I need to do to fix my problem.

By the way: I couldn't update Spark in the virtual machine, since it was brought to me by the HortonWorks distribution...


Looks like network error in the first place (but actually NOT) in the disguise of version mismatch of spark . You can point to correct version of spark jars mostly assembly jars.

This issue may happen due to version miss match in Hadoop RPC call using Protobuffer.

when a protocol message being parsed is invalid in some way, e.g. it contains a malformed varint or a negative byte length.

  • My experience with protobuf, InvalidProtocolBufferException can happen, only when the message was not able to parse(programatically if you are parsing protobuf message, may be message legth is zero or message is corrupted...).

  • Spark uses Akka Actors for Message Passing between Master/Driver and Workers and Internally akka uses googles protobuf to communicate. see method below from AkkaPduCodec.scala)

    override def decodePdu(raw: ByteString): AkkaPdu = {
        try {
          val pdu = AkkaProtocolMessage.parseFrom(raw.toArray)
          if (pdu.hasPayload) Payload(ByteString(pdu.getPayload.asReadOnlyByteBuffer()))
          else if (pdu.hasInstruction) decodeControlPdu(pdu.getInstruction)
          else throw new PduCodecException("Error decoding Akka PDU: Neither message nor control message were contained", null)
        } catch {
          case e: InvalidProtocolBufferException ⇒ throw new PduCodecException("Decoding PDU failed.", e)
        }
      }
    

But in your case, since its version mismatch, new protobuf version message cant be parsed from old version of parser... or something like...

If you are using maven other dependencies, pls. review.