-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
dist/quarkus
Describe the bug
When running tests with the new tests framework with the embedded server mode the JVM is terminated unexpectedly.
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
This is caused by the following code:
keycloak/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java
Lines 196 to 199 in 0f72fa2
public void exit(int exitCode) { | |
// hard exit wanted, as build failed and no subsequent command should be executed. no quarkus involved. | |
System.exit(exitCode); | |
} |
The changes around this was likely introduced by 799ee85
The embedded test server is started with:
Lines 15 to 21 in 0f72fa2
Keycloak.Builder builder = Keycloak.builder().setVersion(Version.VERSION); | |
for(Dependency dependency : keycloakServerConfigBuilder.toDependencies()) { | |
builder.addDependency(dependency.getGroupId(), dependency.getArtifactId(), ""); | |
} | |
keycloak = builder.start(keycloakServerConfigBuilder.toArgs()); |
Version
main
Regression
- The issue is a regression
Expected behavior
Embedded Keycloak server is not terminated abruptly with System.exit
Actual behavior
System.exit
is invoked causing Surefire VM to exit
How to Reproduce?
cd test-framework
KC_TEST_SERVER=embedded mvn clean install -Dtest=FancyRealmTest
To enable remote debugging edit test-framework/examples/tests/pom.xml
and update config for surefire-plugin to:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<java.util.concurrent.ForkJoinPool.common.threadFactory>io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory</java.util.concurrent.ForkJoinPool.common.threadFactory>
</systemPropertyVariables>
</configuration>
</plugin>
Start tests, and run remote debugging from the IDE with a breakpoint on L197 in Picocli
Anything else?
No response