-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fastloader breaks loading MainDispatcherFactory on Jvm Desktop #3914
Comments
This is a Multiplatfrom App by the way building a java application target, so I'm wondering if the classpath is slightly different? Happy try different things. But the work around is disabling fast loader for now which is fine |
I could not reproduce this; for me, this code runs fine. Could you provide a complete project where this issue reproduces? |
Interesting, I'll try to create a sample project |
+1
This indeed helps. Thx |
@alexzhirkevich same issue for you? What is your project setup? I'm trying to create a micro project to reproduce |
@chrisjenx Here is small repro. But this probably not the coroutines issue |
Yes I do. Interesting how that dep breaks it
…On Sun, Nov 5, 2023 at 2:51 AM Alexander Zhirkevich < ***@***.***> wrote:
@chrisjenx <https://github.com/chrisjenx>
Do you have Gitlive/Firebase
<https://github.com/gitLiveApp/firebase-kotlin-sdk/> dependency in your
project? It causes this issue. It brings firebase to java
<https://github.com/gitLiveApp/firebase-java-sdk> using android
dependencies and some workarounds. Probably this dependencies have META-INF
service with android main dispatcher factory which replaces swing one.
Here is small repro
<https://github.com/alexzhirkevich/repro-coroutines-issue>. But this
probably not the coroutines issue
—
Reply to this email directly, view it on GitHub
<#3914 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI5DMMSP2KHNUCGXXYECB3YC5OTJAVCNFSM6AAAAAA56SSN6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGY4DQNZXGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm using Gitlive/Firebase dependency, too. The workaround that fixes this was disabling the service loader:
|
For desktop applications, Swing/JavaFx dispatcher should be picked by our fast SL mechanism. But if there is a dependency on firebase-sdk, it breaks: the dependency repackages Android classes, and we incorrectly assume we are on Android platform. Explicitly take it into account Fixes #3914
@alexzhirkevich thank you for a self-contained reproducer! |
Interesting, as this ready happens inside the firebase-java-sdk: |
Kotlin objects are lazy so this initialization probably performs way too late or doesn't perform at all |
Will always perform before any coroune usage in the sdk |
@nbransby nice catch. I think it is not working because how the dependency of the Firebase (GitLive) library is injected in the code. For instance, later I noticed that I was getting the problem at the very beginning of the code startup (the same time the Firebase dependency was injected through a Service Locator). As @alexzhirkevich mentioned, it's like a race condition problem on how or when that line is invoked 🤔 |
Makes sense, glad there is a fix coming 👍 |
For desktop applications, Swing/JavaFx dispatcher should be picked by our fast SL mechanism. But if there is a dependency on firebase-sdk, it breaks: the dependency repackages Android classes, and we incorrectly assume we are on Android platform. Explicitly take it into account Fixes #3914
Describe the bug
FastLoader will fail in a way that loading the MainDispatcherFactory will appear missing despite being on the classpath.
Kotlin 1.9.20-rc
Compose 1.5.10-beta02
Java 20
Coroutines 1.7.3
Provide a Reproducer
With fast loader on:
Log:
You set
System.setProperty("kotlinx.coroutines.fast.service.loader", "false")
The text was updated successfully, but these errors were encountered: