Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@
import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskCancelledException;
import org.elasticsearch.test.MockLog;
import org.elasticsearch.test.ReachabilityChecker;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.LeakTracker;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.netty4.Netty4Utils;
import org.elasticsearch.xcontent.ToXContentObject;
Expand Down Expand Up @@ -315,14 +317,20 @@ public void onFailure(Exception exception) {

private static Releasable withResourceTracker() {
assertNull(refs);
final ReachabilityChecker reachabilityChecker = new ReachabilityChecker();
final var latch = new CountDownLatch(1);
refs = AbstractRefCounted.of(latch::countDown);
refs = LeakTracker.wrap(reachabilityChecker.register(AbstractRefCounted.of(latch::countDown)));
return () -> {
refs.decRef();
boolean success = false;
try {
safeAwait(latch);
success = true;
} finally {
refs = null;
if (success == false) {
reachabilityChecker.ensureUnreachable();
}
}
Copy link
Copy Markdown
Contributor Author

@nicktindall nicktindall Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LeakTracker will log the sequence of incRef and decRef that resulted in the failure, the ReachabilityChecker will ensure we wait for the LeakTracker to kick in during the test.

};
}
Expand Down
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ tests:
- class: org.elasticsearch.xpack.transform.transforms.TransformIndexerTests
method: testMaxPageSearchSizeIsResetToConfiguredValue
issue: https://github.com/elastic/elasticsearch/issues/109844
- class: "org.elasticsearch.http.netty4.Netty4ChunkedContinuationsIT"
issue: "https://github.com/elastic/elasticsearch/issues/109866"
method: "testClientCancellation"
- class: "org.elasticsearch.test.jvm_crash.JvmCrashIT"
issue: "https://github.com/elastic/elasticsearch/issues/110052"
method: "testJvmCrash"
Expand Down