Skip to content

Commit d26ad3f

Browse files
geoandgsmet
authored andcommitted
Fix ClassLoader leak in KeycloakDevServicesProcessor
Fixes: #42303 (cherry picked from commit d30d070)
1 parent 2109207 commit d26ad3f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ public DevServicesResultBuildItem startKeycloakContainer(
189189
StartupLogCompressor compressor = new StartupLogCompressor(
190190
(launchMode.isTest() ? "(test) " : "") + "Keycloak Dev Services Starting:",
191191
consoleInstalledBuildItem, loggingSetupBuildItem);
192-
if (vertxInstance == null) {
193-
vertxInstance = Vertx.vertx();
194-
}
195192
try {
196193
List<String> errors = new ArrayList<>();
197194

@@ -281,6 +278,12 @@ private Map<String, String> prepareConfiguration(
281278

282279
List<String> realmNames = new LinkedList<>();
283280

281+
// this needs to be only if we actually start the dev-service as it adds a shutdown hook
282+
// whose TCCL is the Augmentation CL, which if not removed, causes a massive memory leaks
283+
if (vertxInstance == null) {
284+
vertxInstance = Vertx.vertx();
285+
}
286+
284287
WebClient client = OidcDevServicesUtils.createWebClient(vertxInstance);
285288
try {
286289
String adminToken = getAdminToken(client, clientAuthServerBaseUrl);

0 commit comments

Comments
 (0)