[ 
https://issues.apache.org/jira/browse/HDFS-9347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wei-Chiu Chuang updated HDFS-9347:
----------------------------------
    Attachment: HDFS-9347.003.patch

Hi [~zhz] Thanks for the suggestion. Agreed the code was not clean. I 
refactored the code a bit, creating a new method anyThreadMatching() in order 
to make it cleaner. The idea is to assert name of the thread which matches the 
regular expression.

An alternative approach would be to create a "assumeNoThreadsMatching()", and 
let it throw an exception if there's any thread that matches it.

> Invariant assumption in TestQuorumJournalManager.shutdown() is wrong
> --------------------------------------------------------------------
>
>                 Key: HDFS-9347
>                 URL: https://issues.apache.org/jira/browse/HDFS-9347
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Wei-Chiu Chuang
>            Assignee: Wei-Chiu Chuang
>         Attachments: HDFS-9347.001.patch, HDFS-9347.002.patch, 
> HDFS-9347.003.patch
>
>
> The code
> {code:title=TestTestQuorumJournalManager.java|borderStyle=solid}
> @After
>   public void shutdown() throws IOException {
>     IOUtils.cleanup(LOG, toClose.toArray(new Closeable[0]));
>     
>     // Should not leak clients between tests -- this can cause flaky tests.
>     // (See HDFS-4643)
>     GenericTestUtils.assertNoThreadsMatching(".*IPC Client.*");
>     
>     if (cluster != null) {
>       cluster.shutdown();
>     }
>   }
> {code}
> implicitly assumes when the call returns from IOUtils.cleanup() (which calls 
> close() on QuorumJournalManager object), all IPC client connection threads 
> are terminated. However, there is no internal implementation that enforces 
> this assumption. Even if the bug reported in HADOOP-12532 is fixed, the 
> internal code still only ensures IPC connections are terminated, but not the 
> thread.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to