1. 程式人生 > >No lease on /目錄: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-2059237550_1, pendingcreates: 8]錯誤及解決方法

No lease on /目錄: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-2059237550_1, pendingcreates: 8]錯誤及解決方法

框架 apache val files leg sid format 遇到 mil

  感覺程序員的世界真是一個變幻無常且精彩絕倫的世界,每次跑程序都會發現不一樣的問題。今天跑MapReduce程序來統計郵箱次數時遇到了一個問題,明明一樣的代碼,別人能跑,我卻跑不了。我相信,基本做這行的都遇到過這種問題。好了,話不多說,來聊聊今天的錯誤吧。

  根據日誌查看到報的錯誤為:No lease on /目錄: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-2059237550_1, pendingcreates: 8],詳細信息如下面日誌所示。

2018-04-02 15:05:04,669 DEBUG [org.apache.hadoop.ipc.Client] - IPC Client (2124974876) connection to ******* from Zimo sending #55
2018-04-02 15:05:04,670 DEBUG
[org.apache.hadoop.ipc.Client] - IPC Client (2124974876) connection to ******* from Zimo got value #55 2018-04-02 15:05:04,671 WARN [org.apache.hadoop.hdfs.DFSClient] - DataStreamer Exception org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException): No lease on /email/out/_temporary/0/_temporary/attempt_local1331388695_0001_r_000000_0/163-r-00000: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-979457887_1, pendingcreates: 8
] at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkLease(FSNamesystem.java:2737) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.analyzeFileState(FSNamesystem.java:2543) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2454) at org
.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387) at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582) at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585) at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042) at org.apache.hadoop.ipc.Client.call(Client.java:1347) at org.apache.hadoop.ipc.Client.call(Client.java:1300) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206) at com.sun.proxy.$Proxy9.addBlock(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102) at com.sun.proxy.$Proxy9.addBlock(Unknown Source) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:514) 2018-04-02 15:05:04,671 ERROR [org.apache.hadoop.hdfs.DFSClient] - Failed to close file /email/out/_temporary/0/_temporary/attempt_local1331388695_0001_r_000000_0/163-r-00000 org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException): No lease on /email/out/_temporary/0/_temporary/attempt_local1331388695_0001_r_000000_0/163-r-00000: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-979457887_1, pendingcreates: 8] at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkLease(FSNamesystem.java:2737) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.analyzeFileState(FSNamesystem.java:2543) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2454) at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387) at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582) at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585) at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048) at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042) at org.apache.hadoop.ipc.Client.call(Client.java:1347) at org.apache.hadoop.ipc.Client.call(Client.java:1300) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206) at com.sun.proxy.$Proxy9.addBlock(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102) at com.sun.proxy.$Proxy9.addBlock(Unknown Source) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078) at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:514) 2018-04-02 15:05:04,672 DEBUG [org.apache.hadoop.ipc.Client] - Stopping client

  在前面跑MapReduce程序的時候沒有出現過這個錯誤,就今天遇到了。遇到這個錯誤時需要在Reducer代碼中加上cleanup方法以重新執行。

  protected void cleanup(Context context) throws IOException,InterruptedException {
            multipleOutputs.close();
   }

  cleanup()方法會被MapReduce框架僅且執行一次,在執行完畢Map任務後,進行相關變量或資源的釋放工作。若是將釋放資源工作放入方法map()中,也會導致Mapper任務在解析、處理每一行文本後釋放資源,而且在下一行文本解析前還要重復初始化,導致反復重復,程序運行效率不高!

  現在我們再重新運行一次程序就會發現問題已經解決了!

以上就是博主為大家介紹的這一板塊的主要內容,這都是博主自己的學習過程,希望能給大家帶來一定的指導作用,有用的還望大家點個支持,如果對你沒用也望包涵,有錯誤煩請指出。如有期待可關註博主以第一時間獲取更新哦,謝謝!

版權聲明:本文為博主原創文章,未經博主允許不得轉載。

No lease on /目錄: File does not exist. [Lease. Holder: DFSClient_NONMAPREDUCE_-2059237550_1, pendingcreates: 8]錯誤及解決方法