hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HIVE-21864) LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
Date Fri, 14 Jun 2019 05:16:00 GMT

     [ https://issues.apache.org/jira/browse/HIVE-21864?focusedWorklogId=260118&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-260118
]

ASF GitHub Bot logged work on HIVE-21864:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/19 05:15
            Start Date: 14/Jun/19 05:15
    Worklog Time Spent: 10m 
      Work Description: ashutosh-bapat commented on pull request #669: HIVE-21864: LlapBaseInputFormat#closeAll()
throws ConcurrentModificationException
URL: https://github.com/apache/hive/pull/669#discussion_r293660724
 
 

 ##########
 File path: itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniLlapArrow.java
 ##########
 @@ -427,5 +437,85 @@ public void testKillQueryByTagOwner() throws Exception {
     assertNotNull("tExecute", tExecuteHolder.throwable);
     assertNull("tCancel", tKillHolder.throwable);
   }
+
+  @Test
+  public void testAddCloseCloseAllConnections() throws Exception {
+    System.out.println("BaseJdbcWithMiniLlap.testAddCloseCloseAllConnections");
+
+    createTestTable("testtab1");
+
+    String url = miniHS2.getJdbcURL();
+    String user = System.getProperty("user.name");
+    String pwd = user;
+
+    InputFormat<NullWritable, Row> inputFormat = getInputFormat();
+
+    // Get splits
+    JobConf job = new JobConf(conf);
+    job.set(LlapBaseInputFormat.URL_KEY, url);
+    job.set(LlapBaseInputFormat.USER_KEY, user);
+    job.set(LlapBaseInputFormat.PWD_KEY, pwd);
+    job.set(LlapBaseInputFormat.QUERY_KEY, "select * from testtab1");
+
+    final String[] handleIds = IntStream.range(0, 20).boxed().map(i -> "handleId-" + i).toArray(String[]::new);
+    final Iterator<String> handleIdsItr = Iterables.cycle(handleIds).iterator();
+
+    final ExceptionHolder exceptionHolder = new ExceptionHolder();
+
+    // addConnThread thread will keep adding connections
+    // closeConnThread thread tries close connection(s) associated to handleIds, one at a
time
+    // closeAllConnThread thread tries to close All at once.
+
+    final int numIterations = 100;
+    Thread addConnThread = new Thread(() -> executeNTimes(() -> {
+      String handleId = handleIdsItr.next();
+      job.set(LlapBaseInputFormat.HANDLE_ID, handleId);
+      InputSplit[] splits = inputFormat.getSplits(job, 1);
+      assertTrue(splits.length > 0);
+      return null;
+    }, numIterations, 1, exceptionHolder));
+
+    Thread closeConnThread = new Thread(() -> executeNTimes(() -> {
+      String handleId = handleIdsItr.next();
+      LlapBaseInputFormat.close(handleId);
+      return null;
+    }, numIterations, 2, exceptionHolder));
+
 
 Review comment:
   Shouldn't you use two separate iterators on handleIds one for addConn and other for closeConn?
The code here is using the same iterator which means two consecutive handleIds.next() one
in addConn and other in closeConn will return different ids, thus trying to close a connection
which wasn't created. Given the infinite cycle nature of iterator, that may not be seen as
a problem but it's better to use two different iterators.
 
----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 260118)
    Time Spent: 1h 10m  (was: 1h)

> LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
> ---------------------------------------------------------------------
>
>                 Key: HIVE-21864
>                 URL: https://issues.apache.org/jira/browse/HIVE-21864
>             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, HIVE-21864.2.patch
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message