Skip to content

Commit

Permalink
[7.1.0] Fix a flaky test by avoiding leaking the eager capability RPC…
Browse files Browse the repository at this point in the history
… thread. (#21550)

Arguably a better fix would be for every test case to properly dispose
of the RemoteModule via afterCommand() and making sure that the leak is
stopped there. Leave a TODO accordingly.

PiperOrigin-RevId: 612417631
Change-Id: I2d6e6e94b405eb777a884c6e10f9d3f9a086fffc
  • Loading branch information
tjgq authored Mar 4, 2024
1 parent 7563479 commit 64887f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ private static ReferenceCountedChannel createChannel(
requirement),
maxConnections);
// Eagerly start creating the channel and verifying the capabilities in the background.
// TODO(tjgq): Make sure this task doesn't linger beyond afterCommand().
var unused =
executorService.submit(
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ public void testVerifyCapabilities_none() throws Exception {
// Remote downloader uses Remote Asset API, and Bazel doesn't have any capability requirement
// on the endpoint. Expecting the request count is 0.
assertThat(cacheCapabilitiesImpl.getRequestCount()).isEqualTo(0);

// Retrieve the execution capabilities so that the asynchronous task that eagerly requests
// them doesn't leak and accidentally interfere with other test cases.
assertThat(remoteModule.getActionContextProvider().getRemoteCache().getCacheCapabilities())
.isEqualTo(EXEC_AND_CACHE_CAPS.getCacheCapabilities());

assertCircuitBreakerInstance();
} finally {
executionServer.shutdownNow();
Expand Down

0 comments on commit 64887f3

Please sign in to comment.