hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Work logged] (HIVE-21864) LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
Date Wed, 12 Jun 2019 13:49:01 GMT


ASF GitHub Bot logged work on HIVE-21864:

                Author: ASF GitHub Bot
            Created on: 12/Jun/19 13:48
            Start Date: 12/Jun/19 13:48
    Worklog Time Spent: 10m 
      Work Description: ashutosh-bapat commented on pull request #669: HIVE-21864: LlapBaseInputFormat#closeAll()
throws ConcurrentModificationException

 File path: llap-ext-client/src/java/org/apache/hadoop/hive/llap/
 @@ -345,8 +346,11 @@ public static void close(String handleId) throws IOException {
   public static void closeAll() {
     LOG.debug("Closing all handles");
-    for (String handleId : connectionMap.keySet()) {
+    Iterator<String> handleIds = connectionMap.keySet().iterator();
+    String handleId = null;
+    while (handleIds.hasNext()) {
       try {
+        handleId =;
 Review comment:
   I looked up many web pages/blogs which discuss "removing an element from HashMap while
iterating over it". All of them suggest one common method i.e. using an iterator. I saw using
ArrayList somewhere, but that's not a common suggestion. If the keySet() doesn't return all
the keys at once to create the ArrayList at once, which it shouldn't ideally, we may be removing
a key which the iterator is scanning, thus causing an exception.
   Since at the end we will remove all the elements, one possible solution is to close all
the connections first by iterating over the Map and then call clear() on the Map. This will
still require us to refactor close() method as suggested earlier.
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

Issue Time Tracking

    Worklog Id:     (was: 258720)
    Time Spent: 40m  (was: 0.5h)

> LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
> ---------------------------------------------------------------------
>                 Key: HIVE-21864
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: llap
>    Affects Versions: 3.1.1
>            Reporter: Shubham Chaurasia
>            Assignee: Shubham Chaurasia
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-21864.1.patch
>          Time Spent: 40m
>  Remaining Estimate: 0h

This message was sent by Atlassian JIRA

View raw message