-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Config property not found when in ForkJoin common Pool thread #20067
Comments
@radcortez I think this is something we have seen before, no? |
Yes, most likely the issue is that the classloader being returned does not have any The safe way to do this is to just retrieve the configuration value before and just pass down the value.
Yes, I think I remember something about this as well, but can't find it. I'm now sure if this was a Zulip discussion or if we have anything here in GH. |
Yes
Yes I guessed that.
Yes, we implemented that workaround but not always as easy as it seems as the value could be loaded by third library. For instance io.smallrye.jwt.build.Jwt read "smallrye.jwt.sign.key.location".
|
One more thing, the workaround does not look acceptable for a long term solution in my opinion as it breaks the Dev/prod parity principle. |
Some additional information here (to not replicate, since it is a bit long conversation): |
@florentgarin a more acceptable solution might be to use the |
ManagedExecutor does not permit to delay execution (see my sample code), otherwise I would use it. |
Thanks. I already know what the issue is. It may take some time to get to an agreeable solution and I didn't want to leave you without a quick answer. |
Describe the bug
Fetching a config property on ForkJoin common Pool thread failed.
Be aware that the behavior is not the same in dev mode and in prod mode as it's work in dev mode.
Expected behavior
Same behavior in prod and dev mode is expected, cfg must be returned.
Actual behavior
In prod mode, reading a property set in application.properties fails (return null).
How to Reproduce?
For instance :
ThreadContext threadContext = ThreadContext.builder()
.propagated(ThreadContext.ALL_REMAINING)
.cleared(ThreadContext.TRANSACTION)
.build();
var expirationTask = threadContext.contextualRunnable(() -> {
var cfg = ConfigProvider.getConfig().getOptionalValue("smallrye.jwt.sign.key.location", String.class).orElse(null);
});
CompletableFuture.runAsync(expirationTask, delayedExecutor(60, TimeUnit.SECONDS));
cfg is null.
Output of
uname -a
orver
#36-Ubuntu SMP Thu Aug 26 19:22:09 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.1.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: