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

'Command DEL does not exist' when using redis as cache #38

Closed
vnesek opened this issue Jun 1, 2020 · 7 comments
Closed

'Command DEL does not exist' when using redis as cache #38

vnesek opened this issue Jun 1, 2020 · 7 comments
Labels
status: awaiting feedback status: awaiting validation Waiting to be validated as a real issue

Comments

@vnesek
Copy link

vnesek commented Jun 1, 2020

Micronaut 1.3.5
Micronaut redis lettuce 2.0.0

When starting up application with @Cacheable annotated methods and redis cache configuration, following exception happens:

15:49:13.984 [pool-1-thread-6] | ERROR i.m.h.s.netty.RoutingInBoundHandler - Unexpected error occurred: Command DEL does not exist Offending method: public abstract java.lang.Long io.micronaut.configuration.lettuce.cache.SyncCacheCommands.del(byte[]...)
io.lettuce.core.dynamic.CommandMethodSyntaxException: Command DEL does not exist Offending method: public abstract java.lang.Long io.micronaut.configuration.lettuce.cache.SyncCacheCommands.del(byte[]...)
	at io.lettuce.core.dynamic.DefaultCommandMethodVerifier.syntaxException(DefaultCommandMethodVerifier.java:165)
	at io.lettuce.core.dynamic.DefaultCommandMethodVerifier.lambda$validate$0(DefaultCommandMethodVerifier.java:70)
	at java.base/java.util.Optional.orElseThrow(Optional.java:401)
	at io.lettuce.core.dynamic.DefaultCommandMethodVerifier.validate(DefaultCommandMethodVerifier.java:69)
	at io.lettuce.core.dynamic.ExecutableCommandLookupStrategySupport$DefaultCommandFactoryResolver.resolveRedisCommandFactory(ExecutableCommandLookupStrategySupport.java:74)
	at io.lettuce.core.dynamic.ExecutableCommandLookupStrategySupport.resolveCommandFactory(ExecutableCommandLookupStrategySupport.java:48)
	at io.lettuce.core.dynamic.AsyncExecutableCommandLookupStrategy.resolveCommandMethod(AsyncExecutableCommandLookupStrategy.java:47)
	at io.lettuce.core.dynamic.RedisCommandFactory$CompositeCommandLookupStrategy.resolveCommandMethod(RedisCommandFactory.java:290)
	at io.lettuce.core.dynamic.RedisCommandFactory$BatchAwareCommandLookupStrategy.resolveCommandMethod(RedisCommandFactory.java:339)
	at io.lettuce.core.dynamic.RedisCommandFactory$CommandFactoryExecutorMethodInterceptor.<init>(RedisCommandFactory.java:215)
	at io.lettuce.core.dynamic.RedisCommandFactory.getCommands(RedisCommandFactory.java:195)
	at io.micronaut.configuration.lettuce.cache.RedisCache.syncCommands(RedisCache.java:298)
	at io.micronaut.configuration.lettuce.cache.RedisCache.getCommands(RedisCache.java:149)
	at io.micronaut.configuration.lettuce.cache.RedisCache.get(RedisCache.java:168)
	at io.micronaut.cache.interceptor.CacheInterceptor.interceptSync(CacheInterceptor.java:174)
	at io.micronaut.cache.interceptor.CacheInterceptor.intercept(CacheInterceptor.java:125)
	at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:69)
	at net.photomath.turk.service.$ClusterStateServiceDefinition$Intercepted.getClusterState(Unknown Source)
	at net.photomath.turk.service.ClusterStateService.updateClusterState(ClusterStateService.kt:84)
	at net.photomath.turk.service.ClusterStateService.setLimits(ClusterStateService.kt:77)
@graemerocher
Copy link
Contributor

Can you provide an example that reproduces the issue? Cannot reproduce this myself

@vnesek
Copy link
Author

vnesek commented Jun 4, 2020

Here is a minimal sample reproducing issue. Project created with micronaut launch, set micronaut version to 1.3.5, run vanilla redis in docker on localhost.

Apparently, it trips over redis.caches. configuration. Perhaps it's some typo I can't see.

package com.foo

import io.micronaut.cache.annotation.Cacheable
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import io.micronaut.runtime.Micronaut
import io.micronaut.scheduling.annotation.Scheduled
import javax.annotation.security.PermitAll
import javax.inject.Singleton
import kotlin.random.Random

@Singleton
open class FooService {

    @Cacheable("my-cache")
    open fun foo(): Int {
        return Random.nextInt()
    }

    @Scheduled(fixedDelay = "60s", initialDelay = "1s")
    open fun autoFail() {
        // Comment out line bellow to get it to work
        foo()
    }
}

@Controller("/api/foo")
@PermitAll
open class FooController(val foo: FooService) {

    @Get
    fun fail() = foo.foo()
}

fun main() {
    Micronaut.build()
        .packages("com.foo")
        .mainClass(FooService::class.java)
        .start()
}
micronaut:
  application:
    name: redisfail
redis:
  uri: redis://localhost
  # Comment out 'caches' section to get it to work
  caches:
    my-cache:
      # expire one hour after write
      expire-after-write: 1h

@graemerocher graemerocher added status: awaiting validation Waiting to be validated as a real issue and removed status: awaiting feedback labels Jun 4, 2020
@jopvanraaij
Copy link

jopvanraaij commented Jun 5, 2020

Had the same issue (using Micronaut 1.3.4, Lettuce 1.2.0), but it was resolved when using Redis docker image redis:5.0.6-alpine instead of redis:5.0.7-alpine (latest and 6 were also failing).

@vnesek
Copy link
Author

vnesek commented Jun 5, 2020

I can confirm that using redis:5.0.6-alpine image works, while newer versions don't. Haven't find anything similiar in lettuce issue tracker. Perhaps some command (DEL?) definitions changed in redis 5.0.6+.

@graemerocher
Copy link
Contributor

Thanks that is useful information in helping us track this issue down.

@graemerocher
Copy link
Contributor

Can you test the 2.3.1 version to see if the issue is resolved for you?

@sdelamo
Copy link
Contributor

sdelamo commented Jul 14, 2020

Attached a ZIP file with a micronaut1.3.4 which reproduces the issue and a Micronaut 2.0 which does not exhibit the issue.

I used redis 6.0.5 for both.

redisdemo.zip

@sdelamo sdelamo closed this as completed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting feedback status: awaiting validation Waiting to be validated as a real issue
Projects
None yet
Development

No branches or pull requests

4 participants