[ https://issues.apache.org/jira/browse/CASSANDRA-13397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983841#comment-15983841 ]
Paulo Motta commented on CASSANDRA-13397: ----------------------------------------- It's already on [trunk|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/service/ActiveRepairService.java#L369].. > Return value of CountDownLatch.await() not being checked in Repair > ------------------------------------------------------------------ > > Key: CASSANDRA-13397 > URL: https://issues.apache.org/jira/browse/CASSANDRA-13397 > Project: Cassandra > Issue Type: Bug > Reporter: Simon Zhou > Assignee: Simon Zhou > Priority: Minor > Fix For: 3.0.x > > Attachments: CASSANDRA-13397-v1.patch > > > While looking into repair code, I realize that we should check return value > of CountDownLatch.await(). Most of the places that we don't check the return > value, nothing bad would happen due to other protection. However, > ActiveRepairService#prepareForRepair should have the check. Code to reproduce: > {code} > public static void testLatch() throws InterruptedException { > CountDownLatch latch = new CountDownLatch(2); > latch.countDown(); > new Thread(() -> { > try { > Thread.sleep(1200); > } catch (InterruptedException e) { > System.err.println("interrupted"); > } > latch.countDown(); > System.out.println("counted down"); > }).start(); > latch.await(1, TimeUnit.SECONDS); > if (latch.getCount() > 0) { > System.err.println("failed"); > } else { > System.out.println("success"); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)