You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Cheng jin (JIRA)" <ji...@apache.org> on 2017/08/15 13:20:00 UTC

[jira] [Commented] (SPARK-21734) spark job blocked by updateDependencies

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

Cheng jin commented on SPARK-21734:
-----------------------------------

we met this problem, in fact , it is like this:

{code:java}
private def doFetchFile(
      url: String,
      targetDir: File,
      filename: String,
      conf: SparkConf,
      securityMgr: SecurityManager,
      hadoopConf: Configuration) {
    val targetFile = new File(targetDir, filename)
    val uri = new URI(url)
    val fileOverwrite = conf.getBoolean("spark.files.overwrite", defaultValue = false)
    Option(uri.getScheme).getOrElse("file") match {
      case "spark" =>
        if (SparkEnv.get == null) {
          throw new IllegalStateException(
            "Cannot retrieve files with 'spark' scheme without an active SparkEnv.")
        }
        val source = SparkEnv.get.rpcEnv.openChannel(url)
        val is = Channels.newInputStream(source)
        downloadFile(url, is, targetFile, fileOverwrite)
      case "http" | "https" | "ftp" =>
        var uc: URLConnection = null
        if (securityMgr.isAuthenticationEnabled()) {
          logDebug("fetchFile with security enabled")
          val newuri = constructURIForAuthentication(uri, securityMgr)
          uc = newuri.toURL().openConnection()
          uc.setAllowUserInteraction(false)
        } else {
          logDebug("fetchFile not using security")
          uc = new URL(url).openConnection()
        }
        Utils.setupSecureURLConnection(uc, securityMgr)

        val timeoutMs =
          conf.getTimeAsSeconds("spark.files.fetchTimeout", "60s").toInt * 1000
        uc.setConnectTimeout(timeoutMs)
        uc.setReadTimeout(timeoutMs)
        uc.connect()
        val in = uc.getInputStream()
        downloadFile(url, in, targetFile, fileOverwrite)
{code}

updatedependencies() -> fetchfile() -> dofetchfile()
it goes  as case "spark" , then open a inputSteam and call read() to download file.
However, call() is a blocking method, does adding a readTimeout work?


> spark job blocked by updateDependencies
> ---------------------------------------
>
>                 Key: SPARK-21734
>                 URL: https://issues.apache.org/jira/browse/SPARK-21734
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 2.2.0
>         Environment: yarn-cluster
>            Reporter: Cheng jin
>
> as above told: I ran a spark job in yarn, it was blocked by bad network here is the exceptions:
> {code:java}
> :at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
> 	at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:46)
> 	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
> 	at sun.nio.ch.IOUtil.read(IOUtil.java:197)
> 	at sun.nio.ch.SourceChannelImpl.read(SourceChannelImpl.java:167)
> 	at org.apache.spark.rpc.netty.NettyRpcEnv$FileDownloadChannel$$anonfun$1.apply$mcI$sp(NettyRpcEnv.scala:371)
> 	at org.apache.spark.rpc.netty.NettyRpcEnv$FileDownloadChannel$$anonfun$1.apply(NettyRpcEnv.scala:371)
> 	at org.apache.spark.rpc.netty.NettyRpcEnv$FileDownloadChannel$$anonfun$1.apply(NettyRpcEnv.scala:371)
> 	at scala.util.Try$.apply(Try.scala:192)
> 	at org.apache.spark.rpc.netty.NettyRpcEnv$FileDownloadChannel.read(NettyRpcEnv.scala:371)
> 	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
> 	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
> 	at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
> 	at java.io.InputStream.read(InputStream.java:101)
> 	at org.apache.spark.util.Utils$$anonfun$copyStream$1.apply$mcJ$sp(Utils.scala:354)
> 	at org.apache.spark.util.Utils$$anonfun$copyStream$1.apply(Utils.scala:322)
> 	at org.apache.spark.util.Utils$$anonfun$copyStream$1.apply(Utils.scala:322)
> 	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1303)
> 	at org.apache.spark.util.Utils$.copyStream(Utils.scala:362)
> 	at org.apache.spark.util.Utils$.downloadFile(Utils.scala:509)
> 	at org.apache.spark.util.Utils$.doFetchFile(Utils.scala:639)
> 	at org.apache.spark.util.Utils$.fetchFile(Utils.scala:450)
> 	at org.apache.spark.executor.Executor$$anonfun$org$apache$spark$executor$Executor$$updateDependencies$5.apply(Executor.scala:659)
> 	at org.apache.spark.executor.Executor$$anonfun$org$apache$spark$executor$Executor$$updateDependencies$5.apply(Executor.scala:651)
> 	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
> 	at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99)
> 	at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:99)
> 	at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
> 	at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
> 	at scala.collection.mutable.HashMap.foreach(HashMap.scala:99)
> 	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
> 	at org.apache.spark.executor.Executor.org$apache$spark$executor$Executor$$updateDependencies(Executor.scala:651)
> 	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:297)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:748)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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