web-dev-qa-db-fra.com

Apache Spark: erreurs de réseau entre les exécuteurs

J'utilise Apache Spark 1.3.1 sur Scala 2.11.2 et, lorsque je travaille sur un cluster HPC avec suffisamment de données, des erreurs telles que celles figurant au bas de mon message (répétition répétée se fait tuer pour le temps qui passe). Sur la base des erreurs, l'exécuteur tente d'obtenir des données aléatoires à partir d'autres nœuds, mais ne peut pas le faire.

Ce même programme s’exécute correctement avec (a) une plus petite quantité de données ou (b) en mode local uniquement. Il a donc quelque chose à voir avec les données envoyées sur le réseau quantité de données).

Le code en cours d'exécution à ce moment-là est le suivant:

val partitioned_data = data  // data was read as sc.textFile(inputFile)
  .zipWithIndex.map(x => (x._2, x._1))
  .partitionBy(partitioner)  // A custom partitioner
  .map(_._2)

// Force previous lazy operations to be evaluated. Presumably adds some
// overhead, but hopefully the minimum possible...
// Suggested on Spark user list: http://Apache-spark-user-list.1001560.n3.nabble.com/Forcing-RDD-computation-with-something-else-than-count-td707.html
sc.runJob(partitioned_data, (iter: Iterator[_]) => {})

Est-ce une indication d'un bug ou y a-t-il quelque chose que je fais mal?

Voici un petit extrait du journal stderr d’un des exécuteurs (le journal complet est ici ):

15/04/21 14:59:28 ERROR TransportRequestHandler: Error sending result ChunkFetchSuccess{streamChunkId=StreamChunkId{streamId=1601401593000, chunkIndex=0}, buffer=FileSegmentManagedBuffer{file=/tmp/spark-0f8d0598-b137-4d14-993a-568b2ab3709a/spark-12d5ff0a-2793-4b76-8a0b-d977a5924925/spark-7ad9382d-05cf-49d4-9a52-d42e6ca7117d/blockmgr-b72d4068-d065-47e6-8a10-867f723000db/15/shuffle_0_1_0.data, offset=26501223, length=6227612}} to /10.0.0.5:41160; closing connection
Java.io.IOException: Resource temporarily unavailable
    at Sun.nio.ch.FileChannelImpl.transferTo0(Native Method)
    at Sun.nio.ch.FileChannelImpl.transferToDirectly(FileChannelImpl.Java:415)
    at Sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.Java:516)
    at org.Apache.spark.network.buffer.LazyFileRegion.transferTo(LazyFileRegion.Java:96)
    at org.Apache.spark.network.protocol.MessageWithHeader.transferTo(MessageWithHeader.Java:89)
    at io.netty.channel.socket.nio.NioSocketChannel.doWriteFileRegion(NioSocketChannel.Java:237)
    at io.netty.channel.nio.AbstractNioByteChannel.doWrite(AbstractNioByteChannel.Java:233)
    at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.Java:264)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.Java:707)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.Java:315)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.Java:676)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.Java:1059)
    at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.Java:688)
    at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.Java:669)
    at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.Java:115)
    at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.Java:688)
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.Java:718)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:706)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:741)
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.Java:895)
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.Java:240)
    at org.Apache.spark.network.server.TransportRequestHandler.respond(TransportRequestHandler.Java:147)
    at org.Apache.spark.network.server.TransportRequestHandler.processFetchRequest(TransportRequestHandler.Java:119)
    at org.Apache.spark.network.server.TransportRequestHandler.handle(TransportRequestHandler.Java:95)
    at org.Apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.Java:91)
    at org.Apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.Java:44)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.Java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.Java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.Java:163)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.Java:787)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:130)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.Java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.Java:116)
    at Java.lang.Thread.run(Thread.Java:619)
15/04/21 14:59:28 ERROR TransportRequestHandler: Error sending result ChunkFetchSuccess{streamChunkId=StreamChunkId{streamId=1601401593000, chunkIndex=1}, buffer=FileSegmentManagedBuffer{file=/tmp/spark-0f8d0598-b137-4d14-993a-568b2ab3709a/spark-12d5ff0a-2793-4b76-8a0b-d977a5924925/spark-7ad9382d-05cf-49d4-9a52-d42e6ca7117d/blockmgr-b72d4068-d065-47e6-8a10-867f723000db/27/shuffle_0_5_0.data, offset=3792987, length=2862285}} to /10.0.0.5:41160; closing connection
Java.nio.channels.ClosedChannelException
15/04/21 14:59:28 ERROR TransportRequestHandler: Error sending result ChunkFetchSuccess{streamChunkId=StreamChunkId{streamId=1601401593002, chunkIndex=0}, buffer=FileSegmentManagedBuffer{file=/tmp/spark-0f8d0598-b137-4d14-993a-568b2ab3709a/spark-12d5ff0a-2793-4b76-8a0b-d977a5924925/spark-7ad9382d-05cf-49d4-9a52-d42e6ca7117d/blockmgr-b72d4068-d065-47e6-8a10-867f723000db/15/shuffle_0_1_0.data, offset=0, length=10993212}} to /10.0.0.6:42426; closing connection
Java.io.IOException: Resource temporarily unavailable
    at Sun.nio.ch.FileChannelImpl.transferTo0(Native Method)
    at Sun.nio.ch.FileChannelImpl.transferToDirectly(FileChannelImpl.Java:415)
    at Sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.Java:516)
    at org.Apache.spark.network.buffer.LazyFileRegion.transferTo(LazyFileRegion.Java:96)
    at org.Apache.spark.network.protocol.MessageWithHeader.transferTo(MessageWithHeader.Java:89)
    at io.netty.channel.socket.nio.NioSocketChannel.doWriteFileRegion(NioSocketChannel.Java:237)
    at io.netty.channel.nio.AbstractNioByteChannel.doWrite(AbstractNioByteChannel.Java:233)
    at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.Java:264)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.Java:707)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.Java:315)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.Java:676)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.Java:1059)
    at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.Java:688)
    at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.Java:669)
    at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.Java:115)
    at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.Java:688)
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.Java:718)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:706)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.Java:741)
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.Java:895)
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.Java:240)
    at org.Apache.spark.network.server.TransportRequestHandler.respond(TransportRequestHandler.Java:147)
    at org.Apache.spark.network.server.TransportRequestHandler.processFetchRequest(TransportRequestHandler.Java:119)
    at org.Apache.spark.network.server.TransportRequestHandler.handle(TransportRequestHandler.Java:95)
    at org.Apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.Java:91)
    at org.Apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.Java:44)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.Java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.Java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.Java:163)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.Java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.Java:319)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.Java:787)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:130)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.Java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.Java:116)
    at Java.lang.Thread.run(Thread.Java:619)
15/04/21 14:59:28 WARN TransportChannelHandler: Exception in connection from node5.someuniversity.edu/10.0.0.5:60089
Java.io.IOException: Connection reset by peer
    at Sun.nio.ch.FileDispatcher.read0(Native Method)
    at Sun.nio.ch.SocketDispatcher.read(SocketDispatcher.Java:21)
    at Sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.Java:233)
    at Sun.nio.ch.IOUtil.read(IOUtil.Java:206)
    at Sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.Java:236)
    at io.netty.buffer.PooledHeapByteBuf.setBytes(PooledHeapByteBuf.Java:234)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.Java:881)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.Java:225)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.Java:119)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.Java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.Java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.Java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.Java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.Java:116)
    at Java.lang.Thread.run(Thread.Java:619)
15/04/21 14:59:28 ERROR TransportResponseHandler: Still have 2 requests outstanding when connection from node5.someuniversity.edu/10.0.0.5:60089 is closed
15/04/21 14:59:28 INFO RetryingBlockFetcher: Retrying fetch (1/3) for 2 outstanding blocks after 5000 ms
21
mjjohnson

Cela semble être un bug lié au système de réseau Netty (service de transfert de bloc), ajouté dans Spark 1.2 . Ajouter .set("spark.shuffle.blockTransferService", "nio") à mon SparkConf a corrigé le bogue, alors tout fonctionne parfaitement.

J'ai trouvé un message sur la liste de diffusion spark-user de quelqu'un qui rencontrait des erreurs similaires, et ils ont suggéré d'essayer nio au lieu de Netty.

SPARK-5085 est similaire, le passage de Netty à nio a résolu leur problème; Cependant, ils ont également pu résoudre le problème en modifiant certains paramètres de réseau. (Je ne l'ai pas encore essayé moi-même, car je ne suis pas sûr d'avoir les bons privilèges d'accès pour le faire sur le cluster.)

16
mjjohnson

Il est également possible que votre configuration Maven soit différente de votre installation de serveur Spark.

Par exemple, vous avez choisi un fichier pom.xml dans un article de blog. Tutoriel

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.Apache.spark/spark-core_2.11 -->
    <dependency>
        <groupId>org.Apache.spark</groupId>
        <artifactId>spark-core_1.3</artifactId>
        <version>1.3</version>
    </dependency>

</dependencies>

Mais vous auriez pu télécharger la version latest 2.3 sur le site Web Apache Spark.

0
Nicolas Zozol