[ https://issues.apache.org/jira/browse/GEODE-9706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Donal Evans resolved GEODE-9706. -------------------------------- Fix Version/s: 1.16.0 Resolution: Fixed This work was completed as part of GEODE-9845, which involved a near-total rewrite of the test in question to resolve flakiness. > OutOfMemoryDUnitTest can be improved > ------------------------------------ > > Key: GEODE-9706 > URL: https://issues.apache.org/jira/browse/GEODE-9706 > Project: Geode > Issue Type: Test > Components: redis > Affects Versions: 1.15.0 > Reporter: Darrel Schneider > Assignee: Donal Evans > Priority: Minor > Fix For: 1.16.0 > > > Kirk Lund made the following suggestions for improving OutOfMemoryDUnitTest: > You might want to consider using ExecutorServiceRule or > DistributedExecutorServiceRule with a CompletableFuture instead of directly > using a thread: > {code:java} > @Rule > public ExecutorServiceRule executorServiceRule = new ExecutorServiceRule(); > CompletableFuture<Void> memoryPressure = executorServiceRule.runAsync(() > -> { > try { > while (true) { > Thread.sleep(1000); > } > } catch (InterruptedException e) { > // done > } > }); > // do something > memoryPressure.cancel(true); > {code} > The cancel(true) will interrupt the thread. If the test throws before that, > ExecutorServiceRule will clean up any threads during tear down by invoking > shutdownNow which will also interrupt any running threads. If the thread > resists interrupt and hangs, the rule should print a stack trace for it as a > test failure which would then make it easy to debug. > ExecutorServiceRule will work well within the controller JVM. If you need a > version of the rule that works within any JVM in a dunit test, then use > DistributedExecutorServiceRule. > Also when the test does a "join()" add a timeout like so: > {code:java} > join(GeodeAwaitility.getTimeout().getSeconds(), TimeUnit.SECONDS); > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)