Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-19344

namenode.LeaseExpiredException while df.write.parquet when reading from non-hdfs source

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.1.0
    • None
    • None
    • None

    Description

      Hi,

      I have a spark code that runs on a yarn cluster and converts csv to parquet using databricks library.
      It works fine when the csv source is hdfs. But when the csv source is non-hdfs, which is usually the case, I come across this exception :

      17/01/24 11:32:17 ERROR DFSClient: Failed to close inode 212936
      org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException): No lease on /user/tj/parquetoutput/test-parquet-500-2/_temporary/0/_temporary/attempt_201701241132_0000_m_000000_0/part-r-00000-72cdfa55-5a4a-4c6c-84a9-84623245b574.snappy.parquet (inode 212936): File does not exist. Holder DFSClient_attempt_201701241132_0000_m_000000_0_1844683042_57 does not have any open files.
      	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkLease(FSNamesystem.java:3521)
      	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.analyzeFileState(FSNamesystem.java:3324)
      	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(FSNamesystem.java:3162)
      	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3122)
      	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:843)
      	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:500)
      	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
      	at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:640)
      	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
      	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2313)
      	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2309)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:422)
      	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1724)
      	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2307)
      
      	at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1552)
      	at org.apache.hadoop.ipc.Client.call(Client.java:1496)
      	at org.apache.hadoop.ipc.Client.call(Client.java:1396)
      	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:233)
      	at com.sun.proxy.$Proxy15.addBlock(Unknown Source)
      	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:457)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:278)
      	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:194)
      	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:176)
      	at com.sun.proxy.$Proxy16.addBlock(Unknown Source)
      	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1489)
      	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1284)
      	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:463)
      
      End of LogType:stderr
      

      More relevant logs:

      17/01/24 11:31:57 INFO SharedState: Warehouse path is 'file:/hadoop/yarn/local/usercache/hdfs/appcache/application_1485176137520_0008/container_e03_1485176137520_0008_02_000001/spark-warehouse'.
      17/01/24 11:31:57 ERROR ApplicationMaster: User class threw exception: org.apache.spark.sql.AnalysisException: Path does not exist: file:/home/<hostname>/test-client;
      org.apache.spark.sql.AnalysisException: Path does not exist: file:/home/<hostname>/test-client;
      	at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$12.apply(DataSource.scala:375)
      	at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$12.apply(DataSource.scala:364)
      	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
      	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
      	at scala.collection.immutable.List.foreach(List.scala:381)
      	at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
      	at scala.collection.immutable.List.flatMap(List.scala:344)
      	at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:364)
      	at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:149)
      	at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:122)
      	at SparkCSVEater$.main(SparkCSVEater.scala:54)
      	at SparkCSVEater.main(SparkCSVEater.scala)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:627)
      17/01/24 11:31:57 INFO ApplicationMaster: Final app status: FAILED, exitCode: 15, (reason: User class threw exception: org.apache.spark.sql.AnalysisException: Path does not exist: file:/home/<hostname>/test-client;)
      
      java.io.FileNotFoundException: File file:/home/talentica/test-client/samplcsv2_500mb does not exist
      It is possible the underlying files have been updated. You can explicitly invalidate the cache in Spark by running 'REFRESH TABLE tableName' command in SQL or by recreating the Dataset/DataFrame involved
      

      It should not happen as the same code works for hdfs csv source.
      Thanks

      Attachments

        Activity

          People

            Unassigned Unassigned
            taransaini43 Taran Saini
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: