Skip to content
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

multipleQueries() randomly throws "java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType" #316

Open
fmagalhaes opened this issue Jan 18, 2022 · 1 comment
Labels
question Further information is requested

Comments

@fmagalhaes
Copy link

Hi Algolia team,

My prod application suddenly started to randomly fail with ClassCastException when using Algolia's search client, without me releasing any app update.
I can see a big amount of events in the crash reporting tool of the prod application, but I wasn't able to reproduce the issue yet,

Stacktrace is as follows:

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
       at com.algolia.search.endpoint.internal.EndpointMultipleIndexImpl.multipleQueries(EndpointMultipleIndex.kt:226)
       at com.algolia.search.endpoint.internal.EndpointMultipleIndexImpl$multipleQueries$1.invokeSuspend(EndpointMultipleIndex.kt:12)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:191)
       at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:147)
       at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.java:15)
       at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:93)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

What's the reason for having multipleQueries() throwing ClassCastException? Is this something that I can solve?

Thanks,
Francisco

@aallam
Copy link
Member

aallam commented Jan 20, 2022

Hello @fmagalhaes, Thank you for reporting this issue. Do you use R8 ? maybe this is related to this issue.

@aallam aallam added the question Further information is requested label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants