-
Notifications
You must be signed in to change notification settings - Fork 102
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
Execution context being lost after using FutureConverters #179
Comments
I have the same issue with async caffeine cache (writen in java) used with scala-java8-compat. valueFuture.whenComplete((value, error) -> {. <---- Here we shift to ForkJoinPool.commonPool() because of scala-java8-compat
if (!completed.compareAndSet(false, true)) {
// Ignore multiple invocations due to ForkJoinPool retrying on delays
return; |
Same here. How did you guys circumvent that? |
Did any of you look at this in detail? Would it be an easy fix without unintended consequences? |
@lrytz I guess the fix would consist in taking an |
This is to circumvent scala#179.
This is to circumvent scala#179.
This is to circumvent scala#179.
One unfortunate feature of ForkJoinPool.commonPool() is that by default, if a Java process observes < 3 CPUs (e.g. if CPU requests in Kubernetes are set this way), then it will use a |
scala-java8-compat/src/main/scala/scala/concurrent/java8/FutureConvertersImpl.scala
Line 35 in 05be2b2
After converting a scala future to a java future, the synchronous functions are implemented by calling async ones.
And it's not using the ones that are taking the extra executor parameter. https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#thenApplyAsync-java.util.function.Function-
In this case, thread local values will be lost including the execution context
The text was updated successfully, but these errors were encountered: