Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to fix d2 warmup unit test issue #1016

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.58.4] - 2024-08-12
- Fix warmup loadbalancer shutdown logic

## [29.58.3] - 2024-08-12
- Disable the warmUp flaky unit test

Expand Down Expand Up @@ -5719,7 +5722,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.58.3...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.58.4...master
[29.58.4]: https://github.com/linkedin/rest.li/compare/v29.58.3...v29.58.4
[29.58.3]: https://github.com/linkedin/rest.li/compare/v29.58.2...v29.58.3
[29.58.2]: https://github.com/linkedin/rest.li/compare/v29.58.1...v29.58.2
[29.58.1]: https://github.com/linkedin/rest.li/compare/v29.58.0...v29.58.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,18 +397,38 @@ private static boolean isModeToWarmUp(DualReadModeProvider.DualReadMode mode, bo
@Override
public void shutdown(PropertyEventThread.PropertyEventShutdownCallback shutdown)
{
// avoid cleaning when you risk to have partial results since some of the services have not loaded yet
// Indicate that shutdown has started
_shuttingDown = true;

// Cancel all outstanding requests
_outstandingRequests.forEach(future -> future.cancel(true));
_outstandingRequests.clear();

_executorService.shutdownNow();
try
{
// Wait again to ensure termination
if (!_executorService.awaitTermination(_warmUpTimeoutMillis, TimeUnit.MILLISECONDS))
{
LOG.warn("Executor service did not terminate in a timely manner.");
}

}
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
LOG.error("Interrupted while waiting for executor service to terminate.", e);
}

// Proceed with cleanup only if all outstanding requests are completed
if (completedOutStandingRequests())
{
// cleanup from unused services
FileSystemDirectory fsDirectory = new FileSystemDirectory(_d2FsDirPath, _d2ServicePath);
fsDirectory.removeAllServicesWithExcluded(_usedServices);
fsDirectory.removeAllClustersWithExcluded(getUsedClusters());
}

_shuttingDown = true;
_outstandingRequests.forEach(future -> future.cancel(true));
_outstandingRequests.clear();
// Finalize shutdown of the load balancer
_loadBalancer.shutdown(shutdown);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testMakingWarmUpRequests() throws URISyntaxException, InterruptedExc
Assert.assertEquals(VALID_FILES.size(), requestCount.get());
}

@Ignore("ingore this flaky test")
@Test(timeOut = 10000)
public void testDeletingFilesAfterShutdown() throws InterruptedException, ExecutionException, TimeoutException
{
createDefaultServicesIniFiles();
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.58.3
version=29.58.4
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
Loading