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 CB6B4200B78 for ; Fri, 2 Sep 2016 18:19:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C9CC3160AAE; Fri, 2 Sep 2016 16:19:27 +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 1A7FD160A8C for ; Fri, 2 Sep 2016 18:19:26 +0200 (CEST) Received: (qmail 83910 invoked by uid 500); 2 Sep 2016 16:19:21 -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 83769 invoked by uid 99); 2 Sep 2016 16:19:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Sep 2016 16:19:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E42732C1B86 for ; Fri, 2 Sep 2016 16:19:20 +0000 (UTC) Date: Fri, 2 Sep 2016 16:19:20 +0000 (UTC) From: "Manoj Govindassamy (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-10830) FsDatasetImpl#removeVolumes() crashes with IllegalMonitorStateException when vol being removed is in use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 02 Sep 2016 16:19:28 -0000 [ https://issues.apache.org/jira/browse/HDFS-10830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15458948#comment-15458948 ] Manoj Govindassamy commented on HDFS-10830: ------------------------------------------- Thanks for working on this [~arpitagarwal] and submitting a patch. Would you be willing to own this bug ? If so, please feel free to assign this bug to yourself. Had a quick look at the patch. I believe the submitted patch will not throw IllegalMonitorStateException. But, looks like the patch also retains the old "polling" model. That is, wait and check in a loop. Wouldn't it be better to go for the following .. * wait and signal model compared to polling * and with a overall timeout to give up or abort the remove volume operation as the other concurrent user is taking a long time to finish his operations and the reference count not going to zero. Please let me know your thoughts on above. > FsDatasetImpl#removeVolumes() crashes with IllegalMonitorStateException when vol being removed is in use > -------------------------------------------------------------------------------------------------------- > > Key: HDFS-10830 > URL: https://issues.apache.org/jira/browse/HDFS-10830 > Project: Hadoop HDFS > Issue Type: Bug > Components: hdfs > Affects Versions: 3.0.0-alpha1 > Reporter: Manoj Govindassamy > Assignee: Manoj Govindassamy > Attachments: HDFS-10830.01.patch > > > {{FsDatasetImpl#removeVolumes()}} operation crashes abruptly with IllegalMonitorStateException whenever the volume being removed is in use concurrently. > Looks like {{removeVolumes()}} is waiting on a monitor object "this" (that is FsDatasetImpl) which it has never locked, leading to IllegalMonitorStateException. This monitor wait happens only the volume being removed is in use (referencecount > 0). The thread performing this remove volume operation thus crashes abruptly and block invalidations for the remove volumes are totally skipped. > {code:title=FsDatasetImpl.java|borderStyle=solid} > @Override > public void removeVolumes(Set volumesToRemove, boolean clearFailure) { > .. > .. > try (AutoCloseableLock lock = datasetLock.acquire()) { <== LOCK acquire datasetLock > for (int idx = 0; idx < dataStorage.getNumStorageDirs(); idx++) { > .. .. .. > asyncDiskService.removeVolume(sd.getCurrentDir()); <== volume SD1 remove > volumes.removeVolume(absRoot, clearFailure); > volumes.waitVolumeRemoved(5000, this); <== WAIT on "this" ?? But, we haven't locked it yet. > This will cause IllegalMonitorStateException > and crash getBlockReports()/FBR thread! > for (String bpid : volumeMap.getBlockPoolList()) { > List blocks = new ArrayList<>(); > for (Iterator it = volumeMap.replicas(bpid).iterator(); > it.hasNext(); ) { > .. .. .. > it.remove(); <== volumeMap removal > } > blkToInvalidate.put(bpid, blocks); > } > .. .. > } <== LOCK release datasetLock > // Call this outside the lock. > for (Map.Entry> entry : > blkToInvalidate.entrySet()) { > .. > for (ReplicaInfo block : blocks) { > invalidate(bpid, block); <== Notify NN of Block removal > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org