nomisRev / kotlin-kafka

Kafka bindings for Kotlin `suspend`, and Kafka streaming operators for KotlinX Flow.
https://nomisRev.github.io/kotlin-kafka/
Apache License 2.0
106 stars 10 forks source link

java.lang.NoSuchMethodError on kotlinx.coroutines.selects.SelectKt.onTimeout #127

Closed martijnblankestijn closed 1 year ago

martijnblankestijn commented 1 year ago

Thanks for the library. Stumbled upon it when looking for a kotlin library in the style of Alpakka which I have used in my Scala days ;-)

When using the library in a testcase, the kafka consumer flow does not process anything and gives the stacktrace below.

Importing the kotlinx-coroutines-bom:1.6.4, the same version as was advertised in the libs.versions.toml to force the use of 1.6.4 within my project did not help. The only thing that helped was cloning the git repo, build a SNAPSHOT from main and that ran without an issue on 1.6.4. It also worked after upgrading the project to kotlinx-coroutines-bom:1.7.1"

Would it be possible to create a new release?

The stacktrace

    Suppressed: java.lang.NoSuchMethodError: 'void kotlinx.coroutines.selects.SelectKt.onTimeout-8Mi8wO0(kotlinx.coroutines.selects.SelectBuilder, long, kotlin.jvm.functions.Function1)'
        at io.github.nomisRev.kafka.internal.FlowTimeChunkedKt$chunked$3.invokeSuspend(FlowTimeChunked.kt:67)
        at io.github.nomisRev.kafka.internal.FlowTimeChunkedKt$chunked$3.invoke(FlowTimeChunked.kt)
        at io.github.nomisRev.kafka.internal.FlowTimeChunkedKt$chunked$3.invoke(FlowTimeChunked.kt)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt$scopedFlow$1$1.invokeSuspend(FlowCoroutine.kt:51)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt$scopedFlow$1$1.invoke(FlowCoroutine.kt)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt$scopedFlow$1$1.invoke(FlowCoroutine.kt)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt.flowScope(FlowCoroutine.kt:33)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt$scopedFlow$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113)
        at PositionConsumer$positionsFlow$1$invokeSuspend$$inlined$map$1.collect(SafeCollector.common.kt:113)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:120)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
        at kotlinx.coroutines.flow.internal.ChannelFlowMerge$collectTo$2$1.invokeSuspend(Merge.kt:69)
        at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:46)
        at io.github.nomisRev.kafka.internal.FlowTimeChunkedKt$chunked$3.invokeSuspend(FlowTimeChunked.kt:91)
        at kotlinx.coroutines.flow.internal.FlowCoroutineKt$scopedFlow$1$1.invokeSuspend(FlowCoroutine.kt:51)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(Emitters.kt:120)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(Emitters.kt:114)
        at kotlinx.coroutines.flow.internal.ChannelFlowMerge$collectTo$2$1.invokeSuspend(Merge.kt:69)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(Emitters.kt:120)
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(Emitters.kt:114)
        at kotlinx.coroutines.flow.FlowKt__CollectKt$launchIn$1.invokeSuspend(Collect.kt:50)
    Caused by: java.lang.NoSuchMethodError: 'void kotlinx.coroutines.selects.SelectKt.onTimeout-8Mi8wO0(kotlinx.coroutines.selects.SelectBuilder, long, kotlin.jvm.functions.Function1)'
        at io.github.nomisRev.kafka.internal.FlowTimeChunkedKt$chunked$3.invokeSuspend(FlowTimeChunked.kt:67)
nomisRev commented 1 year ago

Hey @martijnblankestijn,

Thank you so much for this issue.

There was indeed a breaking change in 1.7.0 of KotlinX. I will release a patch version in the coming week to fix this issue.

martijnblankestijn commented 1 year ago

Thanks, I really appreciate the work!

nomisRev commented 1 year ago

Hey @martijnblankestijn,

Thank you again for the report, and support ☺️ I will invest some more time later this year to polish up the library, and release 1.0.0. Any feedback you might have towards that would be greatly appreciated! A public roadmap will be created soon.

New 0.3.1 release changelog can be found here, https://github.com/nomisRev/kotlin-kafka/releases/tag/0.3.1