8000 Can't start nightly keycloak build with custom providers · Issue #37770 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Can't start nightly keycloak build with custom providers #37770

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

Closed
1 of 2 tasks
performation opened this issue Mar 3, 2025 · 8 comments
Closed
1 of 2 tasks

Can't start nightly keycloak build with custom providers #37770

performation opened this issue Mar 3, 2025 · 8 comments
Labels
area/core kind/bug Categorizes a PR related to a bug team/core-shared

Comments

@performation
Copy link

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

core

Describe the bug

We are trying to run nightly build of keycloak with our custom providers.
We download the nightly keycloak, build our providers against it, the execute kc.sh build ... and finally attempt to start keycloak, but it exits with "A provider JAR was updated since the last build, please rebuild for this to be fully utilized." Perhaps we're doing something wrong, but I can't seem to figure out what.

Keycloak does start with these providers unoptimized, but we would prefer to test it in as close configuration to production as possible.

Version

nightly

Regression

  • The issue is a regression

Expected behavior

Keycloak starts

Actual behavior

Keycloak exists with "A provider JAR was updated since the last build, please rebuild for this to be fully utilized."

How to Reproduce?

Follow my steps.

Anything else?

No response

@performation
Copy link
Author

It seems to be related to #34665

We're trying to understand why our providers are detected as changed. kc.sh show-config displays expected persisted timestamps for kc.provider.file.*.jar.last-modified which are the same as the timestamps of the jar files. What are they compared to?

@shawkins
Copy link
Contributor
shawkins commented Mar 3, 2025

What are they compared to?

The are persisted from, then compared to the current file last modified times.

Is it possible that you are touching the provider jars after build was run?

When it is failing to start, try running another build and doing show-config again and update the issue with anything that is different from the original properties to the new ones.

@keycloak-github-bot
Copy link

Thanks for reporting this issue, but there is insufficient information or lack of steps to reproduce.

Please provide additional details, otherwise this issue will be automatically closed within 14 days.

@performation
Copy link
Author

Is it possible that you are touching the provider jars after build was run?

the jars aren't touched after build

When it is failing to start, try running another build and doing show-config again and update the issue with anything that is different from the original properties to the new ones.

there is no difference.

@shawkins
Copy link
Contributor
shawkins commented Mar 3, 2025

there is no difference.

If the property sets match fully, there is no reason to expect a start error.

Please provide as much of the show-config output as you can and any more details that would seem relevant to reproduction - the full series of steps you are performaing, the operating system, etc.

@performation
Copy link
Author

Apologies, the jars appear indeed to be touched in the deployment environment (my previous test was a local reproduction). This explains why the new modified configuration detection logic rejects the providers.

@fred-hartman
Copy link

This is a variant of this issue, I figured I would share here because this post was the one that pointed us in the correct direction:

Situation

We did not have the problem with Keycloak 26.1.2
When upgrading our AWS Fargate service to Keycloak 26.2.0 the service would immediately exit with the error
April 15, 2025 at 17:56 (UTC-4:00) A provider JAR was updated since the last build, please rebuild for this to be fully utilized.

After numerous builds and re-builds, we found out the following:

  • Building Keycloak with Quarkus, adding our custom providers, running locally on the laptop works like a charm
  • Building Keycloak with Quarkus, adding our custom providers, running in Fargate crashes immediately
  • Building Keycloak with Quarkus, adding only one of our custom providers, running in Fargate crashes immediately
  • Launching Keycloak un-optimized and have it optimize on startup, adding our custom providers, running in Fargate works
  • doing any of this on a VM instead of a Macbook makes no difference
  • re-wrapping it in a RHEL image after the build makes no difference

The extra step it needs to optimize the Quarkus project on first start causes the Fargate task to take an extra 70+ seconds to launch. But then it runs happily with our custom provider classes.

Case A: Broken Build

Before kc.sh build:

$ ls -l --full-time /opt/keycloak/providers/
-rw-r--r-- 1 keycloak root 12436 2025-04-15 16:48:15.489618580 +0000 guac-protocol-mapper-1.1.2-20250414.150825-2.jar
-rw-r--r-- 1 keycloak root 12806 2025-04-15 16:56:36.816908434 +0000 keycloak-event-listener-1.0.2-20250414.150845-1.jar
-rw-rw-r-- 1 keycloak root 256 2025-04-11 12:27:37.000000000 +0000 README.md

Note how the files we copy in have timestamps with milliseconds ("16:48:15.489618580") whereas the timestamp of the README.md file that ships with the Keycloak base image has an "even" timestamp ("12:27:37.000000000").

During the kc.sh build it remembers the millisecond-based timestamps for each custom provider:

kc.provider.file.keycloak-event-listener-1.0.2-20250414.150845-1.jar.last-modified = 1744736196816 (Persisted)
kc.provider.file.guac-protocol-mapper-1.1.2-20250414.150825-2.jar.last-modified = 1744735695489 (Persisted)

Note the UNIX timestamp down to the millisecond: (1744736196816 and 1744735695489).

After kc.sh build:

$ ls -l --full-time /opt/keycloak/providers/
-rw-rw-r-- 1 1000 root 256 2025-04-11 12:27:37 +0000 README.md
-rw-r--r-- 1 1000 root 12436 2025-04-15 16:48:15 +0000 guac-protocol-mapper-1.1.2-20250414.150825-2.jar
-rw-r--r-- 1 1000 root 12806 2025-04-15 16:56:36 +0000 keycloak-event-listener-1.0.2-20250414.150845-1.jar

Note how all three file timestamps are now normalized to full seconds. Milliseconds all gone for the same command.

Case B: Successful Build

Same start situation before the build:

$ ls -l --full-time /opt/keycloak/providers/
-rw-r--r-- 1 keycloak root 12436 2025-04-15 16:48:15.489618580 +0000 guac-protocol-mapper-1.1.2-20250414.150825-2.jar
-rw-r--r-- 1 keycloak root 12806 2025-04-15 16:56:36.816908434 +0000 keycloak-event-listener-1.0.2-20250414.150845-1.jar
-rw-rw-r-- 1 keycloak root 256 2025-04-11 12:27:37.000000000 +0000 README.md

Now I inserted the following trick to my Dockerfile when building the image. Just before running kc.sh build, I touched the two custom JAR files to make them the same modified timestamp as the README.md file:

$ ls -l --full-time /opt/keycloak/providers/
-rw-r--r-- 1 keycloak root 12436 2025-04-11 12:27:37.000000000 +0000 guac-protocol-mapper-1.1.2-20250414.150825-2.jar
-rw-r--r-- 1 keycloak root 12806 2025-04-11 12:27:37.000000000 +0000 keycloak-event-listener-1.0.2-20250414.150845-1.jar
-rw-rw-r-- 1 keycloak root 256 2025-04-11 12:27:37.000000000 +0000 README.md

The milliseconds are now all zeros. During the build, the persisted timestamps are now also rounded to a full second:

kc.provider.file.keycloak-event-listener-1.0.2-20250414.150845-1.jar.last-modified = 1744374457000 (Persisted)
kc.provider.file.guac-protocol-mapper-1.1.2-20250414.150825-2.jar.last-modified = 1744374457000 (Persisted)

And after the build, still all looks sane:

$ ls -l --full-time /opt/keycloak/providers/
-rw-rw-r-- 1 1000 root 256 2025-04-11 12:27:37 +0000 README.md
-rw-r--r-- 1 1000 root 12436 2025-04-11 12:27:37 +0000 guac-protocol-mapper-1.1.2-20250414.150825-2.jar
-rw-r--r-- 1 1000 root 12806 2025-04-11 12:27:37 +0000 keycloak-event-listener-1.0.2-20250414.150845-1.jar

And with this image deployed to Fargate, it starts up nicely.

@shawkins
Copy link
Contributor

See also #38893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/bug Categorizes a PR related to a bug team/core-shared
Projects
None yet
Development

No branches or pull requests

3 participants
0