[
https://issues.apache.org/jira/browse/HBASE-4965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13163966#comment-13163966
]
nkeywal commented on HBASE-4965:
--------------------------------
It's one rule for each test class.
With a fixed surefire, it shows as a standard log in the output. For example:
{noformat}
2011-12-06 15:03:32,982 INFO [main] hbase.HBaseTestingUtility(518): Starting
up minicluster with 1 master(s) and 3 regionserver(s) and 3 datanode(s)
2011-12-06 15:03:34,052 WARN [main] impl.MetricsSystemImpl(137): Metrics
system not started: Cannot locate configuration: tried
hadoop-metrics2-namenode.properties, hadoop-metrics2.properties
[...]
2011-12-06 15:03:41,587 DEBUG [main] client.HTable$ClientScanner(1183):
Finished with scanning at {NAME => '.META.,,1', STARTKEY => '', ENDKEY => '',
ENCODED => 1028785192,}
2011-12-06 15:03:41,588 INFO [main] hbase.HBaseTestingUtility(561):
Minicluster is up
2011-12-06 15:03:41,588 INFO [main]
client.HConnectionManager$HConnectionImplementation(1805): Closed zookeeper
sessionid=0x134159e31930008
2011-12-06 15:03:41,661 INFO [main] hbase.ResourceChecker(117): before
org.apache.hadoop.hbase.client.TestAdmin#testDeleteEditUnknownColumnFamilyAndOrTable:
247 threads, 417 file descriptors
[...]
2011-12-06 15:03:43,282 INFO [main]
client.HConnectionManager$HConnectionImplementation(1805): Closed zookeeper
sessionid=0x134159e31930009
2011-12-06 15:03:43,313 INFO [main] hbase.ResourceChecker(117): after
org.apache.hadoop.hbase.client.TestAdmin#testDeleteEditUnknownColumnFamilyAndOrTable:
265 threads (was 247), 450 file descriptors (was 417). -thread leak?- -file
handle leak?-
[...]
{noformat}
If you're ok with the idea, I will professionalize the code a little and
propose it as a patch.
> Monitor the open file descriptors and the threads counters during the unit
> tests
> --------------------------------------------------------------------------------
>
> Key: HBASE-4965
> URL: https://issues.apache.org/jira/browse/HBASE-4965
> Project: HBase
> Issue Type: Improvement
> Components: test
> Affects Versions: 0.94.0
> Environment: all
> Reporter: nkeywal
> Assignee: nkeywal
> Priority: Minor
> Attachments: ResourceChecker.java, ResourceCheckerJUnitRule.java
>
>
> We're seeing a lot of issues with hadoop-qa related to threads or file
> descriptors.
> Monitoring these counters would ease the analysis.
> Note as well that
> - if we want to execute the tests in the same jvm (because the test is small
> or because we want to share the cluster) we can't afford to leak too many
> resources
> - if the tests leak, it's more difficult to detect a leak in the software
> itself.
> I attach piece of code that I used. It requires two lines in a unit test
> class to:
> - before every test, count the threads and the open file descriptor
> - after every test, compare with the previous value.
> I ran it on some tests; we have for example:
> - client.TestMultiParallel#testBatchWithManyColsInOneRowGetAndPut: 232
> threads (was 231), 390 file descriptors (was 390). => TestMultiParallel uses
> 232 threads!
> - client.TestMultipleTimestamps#testWithColumnDeletes: 152 threads (was 151),
> 283 file descriptors (was 282).
> - client.TestAdmin#testCheckHBaseAvailableClosesConnection: 477 threads (was
> 294), 815 file descriptors (was 461)
> - client.TestMetaMigrationRemovingHTD#testMetaMigration: 149 threads (was
> 148), 310 file descriptors (was 307).
> It's not always leaks, we can expect some pooling effects. But still...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira