+
Skip to content

fix: ensuring exit codes are handled consistently #38661

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

shawkins
Copy link
Contributor

@shawkins shawkins commented Apr 3, 2025

closes: #38161

@shawkins shawkins force-pushed the iss38161 branch 2 times, most recently from 2347344 to 2b85351 Compare April 4, 2025 01:26
closes: keycloak#38161

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
@shawkins shawkins marked this pull request as ready for review April 4, 2025 15:26
@shawkins shawkins requested review from a team as code owners April 4, 2025 15:26
@shawkins shawkins changed the title fix: removing the test launch mode from the raw dist fix: ensuring exit codes are handled consistently Apr 4, 2025
@shawkins
Copy link
Contributor Author

shawkins commented Apr 4, 2025

We were making the test launch mode pull double duty. It was both causing an early exit, and preventing System.exit calls. Rather than removing the launch mode from the raw dist, I'm using it only for the early exit. Now we attempt to detect what type of launch were using by the classloader and adjust our exit handling accordingly. @pedroigor does this work for you / embedded usage?

Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

I tested the embedded server and it seems fine – even better than before as it nows properly exits the process on error instead of just hanging.

Comment on lines -171 to +187
int exitCode = ApplicationLifecycleManager.getExitCode();

if (isTestLaunchMode() || isNonServerMode()) {
// in test mode we exit immediately
// we should be managing this behavior more dynamically depending on the tests requirements (short/long lived)
Quarkus.asyncExit(exitCode);
Quarkus.asyncExit(ApplicationLifecycleManager.getExitCode());
} else {
Quarkus.waitForExit();
}

return exitCode;
return ApplicationLifecycleManager.getExitCode();
Copy link
Contributor

Choose a reason for hiding this comment

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

Jus out of curiosity, why is this change needed? Why can't we store the exit code in a var?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a potential bug, we don't want to store it because it could change while the waiting for exit.

@vmuzikar vmuzikar merged commit b8aae99 into keycloak:main Apr 15, 2025
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RawKeycloakDistribution exit code is always 0
2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载