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

ClassCastException occur when use Redisson batch atomically #7702

Closed
ShinJJang opened this issue Feb 1, 2023 · 0 comments · Fixed by #7743
Closed

ClassCastException occur when use Redisson batch atomically #7702

ShinJJang opened this issue Feb 1, 2023 · 0 comments · Fixed by #7743
Labels
bug Something isn't working

Comments

@ShinJJang
Copy link

ShinJJang commented Feb 1, 2023

Describe the bug
ClassCastException occur when use Redisson batch atomically. [Related Code]
org.redisson.command.CommandBatchService.executeRedisBasedQueue called only in atomic mode
So in batch and not atomic, error is not occurred.

java.lang.ClassCastException: class io.opentelemetry.javaagent.instrumentation.redisson.CompletableFutureWrapper cannot be cast to class org.redisson.command.BatchPromise (io.opentelemetry.javaagent.instrumentation.redisson.CompletableFutureWrapper and org.redisson.command.BatchPromise are in unnamed module of loader 'app')
	at org.redisson.command.CommandBatchService.lambda$executeRedisBasedQueue$9(CommandBatchService.java:388) ~[redisson-3.17.0.jar:3.17.0]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
	at java.util.concurrent.LinkedBlockingDeque.forEachFrom(LinkedBlockingDeque.java:1323) ~[?:?]
	at java.util.concurrent.LinkedBlockingDeque$LBDSpliterator.forEachRemaining(LinkedBlockingDeque.java:1255) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274) ~[?:?]
	at java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3605) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517) ~[?:?]
	at org.redisson.command.CommandBatchService.executeRedisBasedQueue(CommandBatchService.java:389) ~[redisson-3.17.0.jar:3.17.0]
	at org.redisson.command.CommandBatchService.executeAsync(CommandBatchService.java:226) ~[redisson-3.17.0.jar:3.17.0]
	at org.redisson.command.CommandBatchService.execute(CommandBatchService.java:200) ~[redisson-3.17.0.jar:3.17.0]
	at org.redisson.RedissonBatch.execute(RedissonBatch.java:207) ~[redisson-3.17.0.jar:3.17.0]
	at com.lahti.RedisService.execute()

Steps to reproduce
Run code with java agent opentelemetry

fun test_class_cast_error(redissoneClient: RedissonClient) {
        val batchOptions = BatchOptions.defaults().executionMode(BatchOptions.ExecutionMode.REDIS_WRITE_ATOMIC)
        val rBatch = redissoneClient.createBatch(batchOptions)
        val rSet = rBatch.getSet<String>("testkey")
        rSet.deleteAsync()
        rBatch.execute()
}

fun test_not_occur_error(redissoneClient: RedissonClient) {
        // default BatchOptions.ExecutionMode.IN_MEMORY
        val rBatch = redissoneClient.createBatch()
        val rSet = rBatch.getSet<String>("testkey")
        rSet.deleteAsync()
        rBatch.execute()
}

What did you expect to see?
Batch execute atomically without ClassCastException exception

What did you see instead?
Batch execution failed with ClassCastException

What version are you using?
Opentelemetry autoinstrumentation: 1.22.0, 1.21.0
Redisson: 3.19.1, 3.17.2, 3.17.0

Environment
Compiler: Corretto-11.0.16.8.1
OS: macOS 12.5.1

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant