This sample is created to demonstrate an issue that was found on SpringBoot 3.2+ reactive application and Couchbase java client 3.4.11. The issue is triggered by a get request to couchbase server. The sample is based on code from couchbase-jvm-client repo
To trigger the issue the following conditions must be fulfilled:
Hooks.enableAutomaticContextPropagation()
must be called- a micrometer jar should be in class path
onEachOperator
hook is set up and provided a function that sets up tracing lift operator.- a reactor-core 3.6+
Starting the sample:
- Run ReactorClassCastExceptionReproducerSample.main(String[] args)
- Sample throws no exception
- java.lang.ClassCastException exception is thrown
class reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber cannot be cast to class reactor.core.Fuseable$QueueSubscription
- Calling
Hooks.onOperatorDebug()
"fixes" the problem, since lift is wrapped in another object.