From hdfs-issues-return-222804-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Sat Jun 2 22:52:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 64321180609 for ; Sat, 2 Jun 2018 22:52:04 +0200 (CEST) Received: (qmail 51751 invoked by uid 500); 2 Jun 2018 20:52:03 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 51740 invoked by uid 99); 2 Jun 2018 20:52:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Jun 2018 20:52:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 06801CC5E0 for ; Sat, 2 Jun 2018 20:52:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id qzeeVEDR1fAR for ; Sat, 2 Jun 2018 20:52:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6AA9E5F57F for ; Sat, 2 Jun 2018 20:52:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C1DCBE08C7 for ; Sat, 2 Jun 2018 20:52:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 384E121097 for ; Sat, 2 Jun 2018 20:52:00 +0000 (UTC) Date: Sat, 2 Jun 2018 20:52:00 +0000 (UTC) From: "Zsolt Venczel (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HDFS-13121) NPE when request file descriptors when SC read MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-13121?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1649= 9170#comment-16499170 ]=20 Zsolt Venczel edited comment on HDFS-13121 at 6/2/18 8:51 PM: -------------------------------------------------------------- To make sure the test is meaningful I did the following: 1) built the entire hadoop project with the native profile activated as the= =C2=A0added test=C2=A0is triggered with loaded native library only: {code:java} mvn clean install -Pnative -DskipTests {code} 2)=C2=A0Applied the patch having the test only:=C2=A0[^test-only.patch] 3) Run the test in the hadoop-hdfs-project/hadoop-hdfs module: {code:java} mvn test -Dtest=3DTestShortCircuitCache {code} The test fails with {code:java} [INFO]=20 [INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ hadoop-hdfs -= -- [INFO]=20 [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [ERROR] Tests run: 13, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 11= .004 s <<< FAILURE! - in org.apache.hadoop.hdfs.shortcircuit.TestShortCircu= itCache [ERROR] testRequestFileDescriptorsWhenULimit(org.apache.hadoop.hdfs.shortci= rcuit.TestShortCircuitCache) Time elapsed: 0.397 s <<< FAILURE! java.lang.AssertionError: Should not throw NPE when the native library is u= nable to create new files! at org.junit.Assert.fail(Assert.java:88) at org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache.testRequestFil= eDescriptorsWhenULimit(TestShortCircuitCache.java:907) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav= a:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor= Impl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMet= hod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallab= le.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMetho= d.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod= .java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner= .java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner= .java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.j= ava:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4P= rovider.java:273) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Pro= vider.java:238) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.ja= va:159) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassL= oader(ForkedBooter.java:379) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedB= ooter.java:340) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:= 125) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413= ) [INFO]=20 [INFO] Results: [INFO]=20 [ERROR] Failures:=20 [ERROR] TestShortCircuitCache.testRequestFileDescriptorsWhenULimit:907 Shou= ld not throw NPE when the native library is unable to create new files! [INFO]=20 [ERROR] Tests run: 13, Failures: 1, Errors: 0, Skipped: 0 [INFO]=20 {code} 4) I reset my branch to HEAD and apply [^HDFS-13121.03.patch]. Running the test again results with: {code:java} [INFO]=20 [INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ hadoop-hdfs -= -- [INFO]=20 [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.2= 68 s - in org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [INFO]=20 [INFO] Results: [INFO]=20 [INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0 [INFO]=20 {code} was (Author: zvenczel): To make sure the test is meaningful I did the following: 1) built the entire hadoop project with the native profile activated as the= =C2=A0added test=C2=A0is triggered with loaded native library only: {code:java} mvn clean install -Pnative -DskipTests {code} 2)=C2=A0Applied the patch having the test only:=C2=A0[^test-only.patch] 3) Run the test in the hadoop-hdfs-project/hadoop-hdfs module: {code:java} mvn test -Dtest=3DTestShortCircuitCache {code} The test fails with {code:java} [INFO]=20 [INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ hadoop-hdfs -= -- [INFO]=20 [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [ERROR] Tests run: 13, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.= 842 s <<< FAILURE! - in org.apache.hadoop.hdfs.shortcircuit.TestShortCircui= tCache [ERROR] testRequestFileDescriptorsWhenULimit(org.apache.hadoop.hdfs.shortci= rcuit.TestShortCircuitCache) Time elapsed: 0.355 s <<< ERROR! java.lang.NullPointerException =09at org.apache.hadoop.hdfs.shortcircuit.ShortCircuitReplica.(ShortC= ircuitReplica.java:129) =09at org.apache.hadoop.hdfs.client.impl.BlockReaderFactory.requestFileDesc= riptors(BlockReaderFactory.java:620) =09at org.apache.hadoop.hdfs.client.impl.BlockReaderFactory.createShortCirc= uitReplicaInfo(BlockReaderFactory.java:553) =09at org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache.testRequest= FileDescriptorsWhenULimit(TestShortCircuitCache.java:903) =09at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) =09at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.= java:62) =09at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces= sorImpl.java:43) =09at java.lang.reflect.Method.invoke(Method.java:498) =09at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framework= Method.java:47) =09at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCal= lable.java:12) =09at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMe= thod.java:44) =09at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMet= hod.java:17) =09at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) =09at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun= ner.java:70) =09at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun= ner.java:50) =09at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) =09at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) =09at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) =09at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) =09at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) =09at org.junit.runners.ParentRunner.run(ParentRunner.java:309) =09at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide= r.java:365) =09at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUni= t4Provider.java:273) =09at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4= Provider.java:238) =09at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider= .java:159) =09at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla= ssLoader(ForkedBooter.java:379) =09at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork= edBooter.java:340) =09at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.ja= va:125) =09at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:= 413) [INFO]=20 [INFO] Results: [INFO]=20 [ERROR] Errors:=20 [ERROR] TestShortCircuitCache.testRequestFileDescriptorsWhenULimit:903 = =C2=BB NullPointer [INFO]=20 [ERROR] Tests run: 13, Failures: 0, Errors: 1, Skipped: 0 [INFO]=20 [INFO] --------------------------------------------------------------------= ---- [INFO] BUILD FAILURE [INFO] --------------------------------------------------------------------= ---- [INFO] Total time: 16.245 s [INFO] Finished at: 2018-06-02T21:56:14+02:00 [INFO] Final Memory: 44M/711M {code} 4) I reset my branch to HEAD and apply [^HDFS-13121.02.patch]. Running the test again results with: {code:java} [INFO]=20 [INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ hadoop-hdfs -= -- [INFO]=20 [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.2= 68 s - in org.apache.hadoop.hdfs.shortcircuit.TestShortCircuitCache [INFO]=20 [INFO] Results: [INFO]=20 [INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0 [INFO]=20 {code} > NPE when request file descriptors when SC read > ---------------------------------------------- > > Key: HDFS-13121 > URL: https://issues.apache.org/jira/browse/HDFS-13121 > Project: Hadoop HDFS > Issue Type: Bug > Components: hdfs-client > Affects Versions: 3.0.0 > Reporter: Gang Xie > Assignee: Zsolt Venczel > Priority: Minor > Attachments: HDFS-13121.01.patch, HDFS-13121.02.patch, HDFS-13121= .03.patch, test-only.patch > > > Recently, we hit an issue that the DFSClient throws NPE. The case is that= , the app process exceeds the limit of the max open file. In the case, the = libhadoop never throw and exception but return null to the request of fds. = But=C2=A0requestFileDescriptors use the returned fds directly without any c= heck and then NPE.=C2=A0 > =C2=A0 > We need add a sanity check here of null pointer. > =C2=A0 > private ShortCircuitReplicaInfo requestFileDescriptors(DomainPeer peer, > Slot slot) throws IOException { > ShortCircuitCache cache =3D clientContext.getShortCircuitCache(); > final DataOutputStream out =3D > new DataOutputStream(new BufferedOutputStream(peer.getOutputStream())); > SlotId slotId =3D slot =3D=3D null ? null : slot.getSlotId(); > new Sender(out).requestShortCircuitFds(block, token, slotId, 1, > failureInjector.getSupportsReceiptVerification()); > DataInputStream in =3D new DataInputStream(peer.getInputStream()); > BlockOpResponseProto resp =3D BlockOpResponseProto.parseFrom( > PBHelperClient.vintPrefixed(in)); > DomainSocket sock =3D peer.getDomainSocket(); > failureInjector.injectRequestFileDescriptorsFailure(); > switch (resp.getStatus()) { > case SUCCESS: > byte buf[] =3D new byte[1]; > FileInputStream[] fis =3D new FileInputStream[2]; > {color:#d04437}sock.recvFileInputStreams(fis, buf, 0, buf.length);{color= } > ShortCircuitReplica replica =3D null; > try { > ExtendedBlockId key =3D > new ExtendedBlockId(block.getBlockId(), block.getBlockPoolId()); > if (buf[0] =3D=3D USE_RECEIPT_VERIFICATION.getNumber()) { > LOG.trace("Sending receipt verification byte for slot {}", slot); > sock.getOutputStream().write(0); > } > {color:#d04437}replica =3D new ShortCircuitReplica(key, fis[0], fis[1], = cache,{color} > {color:#d04437} Time.monotonicNow(), slot);{color} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org