Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2A8DF200CF8 for ; Thu, 14 Sep 2017 23:01:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 298CC1609CD; Thu, 14 Sep 2017 21:01:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 479B51609C6 for ; Thu, 14 Sep 2017 23:01:20 +0200 (CEST) Received: (qmail 72629 invoked by uid 500); 14 Sep 2017 21:01:13 -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 72618 invoked by uid 99); 14 Sep 2017 21:01:13 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 21:01:13 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 817C51A695D for ; Thu, 14 Sep 2017 21:01:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 1ZjCz4v9yhtd for ; Thu, 14 Sep 2017 21:01:11 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 0B6906103C for ; Thu, 14 Sep 2017 21:01:10 +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 A9BB8E0E2B for ; Thu, 14 Sep 2017 21:01:08 +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 904ED253A6 for ; Thu, 14 Sep 2017 21:01:06 +0000 (UTC) Date: Thu, 14 Sep 2017 21:01:06 +0000 (UTC) From: "Ruslan Dautkhanov (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-11851) getGlobalJNIEnv() may deadlock if exception is thrown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 14 Sep 2017 21:01:21 -0000 [ https://issues.apache.org/jira/browse/HDFS-11851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16166959#comment-16166959 ] Ruslan Dautkhanov commented on HDFS-11851: ------------------------------------------ After applying this patch program started core dumping - here's gdb back trace {code} (gdb) bt #0 0x00007fe78a34b1d7 in raise () from /lib64/libc.so.6 #1 0x00007fe78a34c8c8 in abort () from /lib64/libc.so.6 #2 0x00007fe78b212185 in os::abort(bool) () from /usr/java/default/jre/lib/amd64/server/libjvm.so #3 0x00007fe78b3b4593 in VMError::report_and_die() () from /usr/java/default/jre/lib/amd64/server/libjvm.so #4 0x00007fe78b21768f in JVM_handle_linux_signal () from /usr/java/default/jre/lib/amd64/server/libjvm.so #5 0x00007fe78b20dbe3 in signalHandler(int, siginfo*, void*) () from /usr/java/default/jre/lib/amd64/server/libjvm.so #6 #7 0x00007fe78a6db8b0 in setTLSExceptionStrings () from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 #8 0x00007fe78a6da52c in printExceptionAndFreeV () from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 #9 0x00007fe78a6da6cd in printExceptionAndFree () from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 #10 0x00007fe78a6db60b in getJNIEnv () from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 #11 0x00007fe78a6dd034 in hdfsBuilderConnect () from /opt/cloudera/parcels/CDH/lib64/libhdfs.so.0.0.0 #12 0x0000000000400950 in main () {code} As you can see it happens in setTLSExceptionStrings () so definitely related to this patch. I can upload a hs_err*.log log file if it will be helpful. > getGlobalJNIEnv() may deadlock if exception is thrown > ----------------------------------------------------- > > Key: HDFS-11851 > URL: https://issues.apache.org/jira/browse/HDFS-11851 > Project: Hadoop HDFS > Issue Type: Bug > Components: libhdfs > Affects Versions: 3.0.0-alpha4 > Reporter: Henry Robinson > Assignee: Sailesh Mukil > Priority: Blocker > Fix For: 3.0.0-alpha4 > > Attachments: HDFS-11851.000.patch, HDFS-11851.001.patch, HDFS-11851.002.patch, HDFS-11851.003.patch, HDFS-11851.004.patch, HDFS-11851.005.patch > > > HDFS-11529 introduced a deadlock into {{getGlobalJNIEnv()}} if an exception is thrown. {{getGlobalJNIEnv()}} holds {{jvmMutex}}, but {{printExceptionAndFree()}} will eventually try to acquire that lock in {{setTLSExceptionStrings()}}. > The exception might get caught from {{loadFileSystems}}: > {code} > jthr = invokeMethod(env, NULL, STATIC, NULL, > "org/apache/hadoop/fs/FileSystem", > "loadFileSystems", "()V"); > if (jthr) { > printExceptionAndFree(env, jthr, PRINT_EXC_ALL, "loadFileSystems"); > } > } > {code} > and here's the relevant parts of the stack trace from where I call this API in Impala, which uses {{libhdfs}}: > {code} > #0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 > #1 0x00007ffff4a8d657 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0 > #2 0x00007ffff4a8d480 in __GI___pthread_mutex_lock (mutex=0x47ce960 ) at ../nptl/pthread_mutex_lock.c:79 > #3 0x0000000002f06056 in mutexLock (m=) at /data/2/jenkins/workspace/impala-hadoop-dependency/hadoop/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/os/posix/mutexes.c:28 > #4 0x0000000002efe817 in setTLSExceptionStrings (rootCause=0x0, stackTrace=0x0) at /data/2/jenkins/workspace/impala-hadoop-dependency/hadoop/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:581 > #5 0x0000000002f065d7 in printExceptionAndFreeV (env=0x513c1e8, exc=0x508a8c0, noPrintFlags=, fmt=0x34349cf "loadFileSystems", ap=0x7fffffffb660) > at /data/2/jenkins/workspace/impala-hadoop-dependency/hadoop/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/exception.c:183 > #6 0x0000000002f0683d in printExceptionAndFree (env=, exc=, noPrintFlags=, fmt=) > at /data/2/jenkins/workspace/impala-hadoop-dependency/hadoop/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/exception.c:213 > #7 0x0000000002eff60f in getGlobalJNIEnv () at /data/2/jenkins/workspace/impala-hadoop-dependency/hadoop/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c:463 > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org