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

Fix QuarkusClassLoader leak in QuarkusProdModeTest #17956

Merged
merged 1 commit into from
Jun 16, 2021
Merged
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 @@ -312,20 +312,7 @@ public void beforeAll(ExtensionContext extensionContext) throws Exception {
originalHandlers = rootLogger.getHandlers();
rootLogger.addHandler(inMemoryLogHandler);

timeoutTask = new TimerTask() {
@Override
public void run() {
System.err.println("Test has been running for more than 5 minutes, thread dump is:");
for (Map.Entry<Thread, StackTraceElement[]> i : Thread.getAllStackTraces().entrySet()) {
System.err.println("\n");
System.err.println(i.toString());
System.err.println("\n");
for (StackTraceElement j : i.getValue()) {
System.err.println(j);
}
}
}
};
timeoutTask = new PrintStackTraceTimerTask();
timeoutTimer.schedule(timeoutTask, 1000 * 60 * 5);

ExtensionContext.Store store = extensionContext.getRoot().getStore(ExtensionContext.Namespace.GLOBAL);
Expand Down Expand Up @@ -638,6 +625,7 @@ public void afterAll(ExtensionContext extensionContext) throws Exception {
try {
if (curatedApplication != null) {
curatedApplication.close();
curatedApplication = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was probably enough to fix the issue, but when analyzing I found the timer one first and then this

}
} finally {
timeoutTask.cancel();
Expand Down Expand Up @@ -699,4 +687,18 @@ public QuarkusProdModeTest setCommandLineParameters(String... commandLineParamet
return this;
}

private static class PrintStackTraceTimerTask extends TimerTask {
@Override
public void run() {
System.err.println("Test has been running for more than 5 minutes, thread dump is:");
for (Map.Entry<Thread, StackTraceElement[]> i : Thread.getAllStackTraces().entrySet()) {
System.err.println("\n");
System.err.println(i.toString());
System.err.println("\n");
for (StackTraceElement j : i.getValue()) {
System.err.println(j);
}
}
}
}
}