8000 fix: ensuring exit codes are handled consistently by shawkins · Pull Request #38661 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: ensuring exit codes are handled consistently - #38661

Merged
vmuzikar merged 2 commits into
keycloak:mainfrom
shawkins:iss38161
Apr 15, 2025
Merged

vmuzikar merged 2 commits into
keycloak:mainfrom
shawkins:iss38161

Conversation

@shawkins
@shawkins shawkins commented Apr 3, 2025
Copy link
Copy Markdown
Contributor

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
shawkins commented Apr 4, 2025
Copy link
Copy Markdown
Contributor Author

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?

@vmuzikar vmuzikar left a comment
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
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

0