hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manoj Govindassamy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-10830) FsDatasetImpl#removeVolumes() crashes with IllegalMonitorStateException when vol being removed is in use
Date Fri, 09 Sep 2016 22:07:20 GMT

    [ https://issues.apache.org/jira/browse/HDFS-10830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15478411#comment-15478411
] 

Manoj Govindassamy commented on HDFS-10830:
-------------------------------------------

[~arpitagarwal], In the following block,
* Try/catch is no more needed around line 650: {{dataset.removeVolumes(v}}. Especially line
654 and line 655 have to be removed.
* By doing so, this {{VolRemoveThread}} would become just like the one in branch-2 patch in
HDFS-9781. Refer: [HDFS-9781-branch-2.004.patch|https://issues.apache.org/jira/secure/attachment/12827841/HDFS-9781-branch-2.004.patch].

{code:title=TestFsDatasetImpl#testRemoveVolumeBeingWritten|linenumbers=true|firstline=637}
    class VolRemoveThread extends Thread {
      public void run() {
        try {
          Set<File> volumesToRemove = new HashSet<>();
          volumesToRemove.add(StorageLocation.parse(
              dataset.getVolume(eb).getBasePath()).getFile());
          /**
           * TODO: {@link FsDatasetImpl#removeVolumes(Set, boolean)} is throwing
           * IllegalMonitorStateException when there is a parallel reader/writer
           * to the volume. Remove below exception handling block after fixing
           * HDFS-10830.
           */
          LOG.info("Removing volume " + volumesToRemove);
          dataset.removeVolumes(volumesToRemove, true);
          volRemoveCompletedLatch.countDown();
          LOG.info("Removed volume " + volumesToRemove);
        } catch (Exception e) {
          LOG.info("Unexpected issue while removing volume: ", e);
          volRemoveCompletedLatch.countDown();
        }
      }
    }
{code}

> 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: Arpit Agarwal
>         Attachments: HDFS-10830.01.patch, HDFS-10830.02.patch, HDFS-10830.03.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<File> 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<ReplicaInfo> blocks = new ArrayList<>();
>     for (Iterator<ReplicaInfo> 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<String, List<ReplicaInfo>> 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


Mime
View raw message