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

ERR Unsupported CONFIG parameter: notify-keyspace-events #113

Closed
michael-wirth opened this issue Jan 20, 2015 · 9 comments
Closed

ERR Unsupported CONFIG parameter: notify-keyspace-events #113

michael-wirth opened this issue Jan 20, 2015 · 9 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@michael-wirth
Copy link

I try to run the samples, but I always get the exception below. How do I fix the problem? Do I need to change some versions?

Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: ERR Unsupported CONFIG parameter: notify-keyspace-events; nested exception is redis.clien
ts.jedis.exceptions.JedisDataException: ERR Unsupported CONFIG parameter: notify-keyspace-events
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:44)
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:36)
        at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:37)
        at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:195)
        at org.springframework.data.redis.connection.jedis.JedisConnection.setConfig(JedisConnection.java:618)
        at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotificationsInitializer.afterProp
ertiesSet(RedisHttpSessionConfiguration.java:170)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
        ... 22 more
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Unsupported CONFIG parameter: notify-keyspace-events
        at redis.clients.jedis.Protocol.processError(Protocol.java:113)
        at redis.clients.jedis.Protocol.process(Protocol.java:138)
        at redis.clients.jedis.Protocol.read(Protocol.java:192)
        at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)
        at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:181)
        at redis.clients.jedis.Jedis.configSet(Jedis.java:2480)
        at org.springframework.data.redis.connection.jedis.JedisConnection.setConfig(JedisConnection.java:616)
        ... 25 more
@rwinch rwinch added the for: stack-overflow A question that's better suited to stackoverflow.com label Jan 20, 2015
@rwinch rwinch self-assigned this Jan 20, 2015
@rwinch
Copy link
Member

rwinch commented Jan 20, 2015

Thank you for your feedback.

@EnableRedisHttpSession requires Redis 2.8.0+ I have added #115 to document this.

The reasoning is that the keyspace notifications are used to ensure that the SessionDestroyedEvent is fired. This is especially important if you are using Spring Session with WebSocket support.

If you are not using Spring Session with WebSocket support, then you can use a configuration similar to the following:

@Configuration
@EnableScheduling
public class RedisHttpSessionConfiguration {
    // set to some value i.e. @Value("${spring.session.inactive}")
    private Integer maxInactiveIntervalInSeconds;

    @Bean
    public RedisTemplate<String,ExpiringSession> sessionRedisTemplate(RedisConnectionFactory connectionFactory) {
        RedisTemplate<String, ExpiringSession> template = new RedisTemplate<String, ExpiringSession>();
        template.setKeySerializer(new StringRedisSerializer());
        template.setHashKeySerializer(new StringRedisSerializer());
        template.setConnectionFactory(connectionFactory);
        return template;
    }

    @Bean
    public RedisOperationsSessionRepository sessionRepository(RedisTemplate<String, ExpiringSession> sessionRedisTemplate) {
        RedisOperationsSessionRepository sessionRepository = new RedisOperationsSessionRepository(sessionRedisTemplate);
        sessionRepository.setDefaultMaxInactiveInterval(maxInactiveIntervalInSeconds);
        return sessionRepository;
    }

    @Bean
    public <S extends ExpiringSession> SessionRepositoryFilter<? extends ExpiringSession> springSessionRepositoryFilter(SessionRepository<S> sessionRepository) {
        SessionRepositoryFilter<S> sessionRepositoryFilter = new SessionRepositoryFilter<S>(sessionRepository);
        return sessionRepositoryFilter;
    }
}

@rwinch rwinch closed this as completed Jan 20, 2015
@ghillert
Copy link

@rwinch Please re-open. The problem is that embedded-redis bundles an older Redis version 2.6.

I have create a GitHub issue for that project: kstyrc/embedded-redis#23

@rwinch rwinch reopened this Jan 27, 2015
@rwinch
Copy link
Member

rwinch commented Jan 27, 2015

Thanks for looking into this @ghillert I have reopened the issue

@rwinch rwinch closed this as completed in a7f686a Feb 23, 2015
rwinch added a commit that referenced this issue Feb 23, 2015
Upgrade to embedded-redis:0.4 (fixes #113)
@rwinch
Copy link
Member

rwinch commented Feb 23, 2015

Thanks to a PR from @domdorn this should now be resolved in master!

@rwinch rwinch added this to the 1.0.1 milestone Feb 23, 2015
@rwinch rwinch added type: bug A general bug and removed for: stack-overflow A question that's better suited to stackoverflow.com labels Feb 23, 2015
@szabobar
Copy link

Sorry, but after I added 1.0.1-BUILD_SNAPSHOT dependency, I also got that error, so that fix does not resolve the bug.

@rwinch
Copy link
Member

rwinch commented Mar 17, 2015

@szabobar Let's track this issue further on #174

@michael-wirth
Copy link
Author

@szabobar I guess you're using Windows (as myself).

The embedded-redis:0.4 contains Redis 2.8 for Linux and Mac, but only version 2.6 for Windows. You have to patch the embedded-redis artifact or define an external path to your lokal Redis 2.8 executable.

@rwinch
Copy link
Member

rwinch commented Mar 17, 2015

@t4gedieb Thanks for the response. Can you respond to @kstyrc on kstyrc/embedded-redis#23 so that we can get the Windows version updated too?

@Presha181
Copy link

add following bean in HttpSessionConfig

@bean
public static ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}

gregturn added a commit that referenced this issue Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants