Skip to content

Ignore failed rename operation for deleted session #1177

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

Closed
vpavic opened this issue Sep 4, 2018 · 4 comments
Closed

Ignore failed rename operation for deleted session #1177

vpavic opened this issue Sep 4, 2018 · 4 comments
Assignees
Labels
in: redis type: backport An issue that is a backport of another issue to a maintenance branch type: bug A general bug
Milestone

Comments

@vpavic
Copy link
Contributor

vpavic commented Sep 4, 2018

Backport of #1137.

@vpavic vpavic added type: bug A general bug Data Store in: redis type: backport An issue that is a backport of another issue to a maintenance branch labels Sep 4, 2018
@vpavic vpavic added this to the 2.0.6 milestone Sep 4, 2018
@vpavic vpavic self-assigned this Sep 4, 2018
vpavic added a commit that referenced this issue Sep 4, 2018
Attempting to change session id for a deleted session currently results in "ERR no such key" error on rename operation of expired key. This commit addressed the problem by ignoring the aforementioned error.

Closes #1177
@vpavic vpavic closed this as completed Sep 4, 2018
@adchilds
Copy link

@vpavic apologies for commenting on a closed issue, but I'm not sure the fix here solves the issue. It looks like the issue is related to the sessionIdKey a few lines above, not the expiredKey, given the stack trace in #1137. Can you confirm?

@vpavic
Copy link
Contributor Author

vpavic commented Nov 1, 2018

Are you still experiencing this problem @adchilds or is your feedback based on something else?

Stacktrace from #1137 includes this line:

at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.saveChangeSessionId(RedisOperationsSessionRepository.java:815)

The issue was reported against 2.0.4.RELEASE which handles the rename of expiredKey on line 815:

https://github.com/spring-projects/spring-session/blob/2.0.4.RELEASE/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java#L815-L816

I believe you're considering the current state of RedisOperationsSessionRepository and not the one from the release against which #1137 was raised.

@adchilds
Copy link

adchilds commented Nov 2, 2018

@vpavic I think you're right; I was not looking at the correct version of the repository when #1137 was raised. I am running into the same error, however, on https://github.com/spring-projects/spring-session/blob/master/spring-session-data-redis/src/main/java/org/springframework/session/data/redis/RedisOperationsSessionRepository.java#L867

RedisOperationsSessionRepository.this.sessionRedisOperations.rename(originalSessionIdKey, sessionIdKey);

Stacktrace:

org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR no such key
    at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:54) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:52) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:257) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.lettuce.LettuceKeyCommands.convertLettuceAccessException(LettuceKeyCommands.java:650) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.lettuce.LettuceKeyCommands.rename(LettuceKeyCommands.java:249) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.connection.DefaultedRedisConnection.rename(DefaultedRedisConnection.java:96) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.lambda$rename$13(RedisTemplate.java:889) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.data.redis.core.RedisTemplate.rename(RedisTemplate.java:888) ~[spring-data-redis-2.0.11.RELEASE.jar:2.0.11.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.saveChangeSessionId(RedisOperationsSessionRepository.java:867) ~[spring-session-data-redis-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.saveDelta(RedisOperationsSessionRepository.java:826) ~[spring-session-data-redis-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository$RedisSession.access$000(RedisOperationsSessionRepository.java:703) ~[spring-session-data-redis-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.save(RedisOperationsSessionRepository.java:421) ~[spring-session-data-redis-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.save(RedisOperationsSessionRepository.java:247) ~[spring-session-data-redis-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.commitSession(SessionRepositoryFilter.java:234) ~[spring-session-core-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.access$100(SessionRepositoryFilter.java:197) ~[spring-session-core-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:150) ~[spring-session-core-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81) ~[spring-session-core-2.0.7.RELEASE.jar:2.0.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.10.RELEASE.jar:5.0.10.RELEASE]
    ...
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: io.lettuce.core.RedisCommandExecutionException: ERR no such key
    at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:135) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:108) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:646) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:604) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:556) ~[lettuce-core-5.1.2.RELEASE.jar:na]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[netty-transport-4.1.29.Final.jar:4.1.29.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[netty-transport-4.1.29.Final.jar:4.1.29.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[netty-transport-4.1.29.Final.jar:4.1.29.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) ~[netty-transport-4.1.29.Final.jar:4.1.29.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[netty-transport-4.1.29.Final.jar:4.1.29.Final]
    ...

This seems to be happening with both Lettuce and Jedis. Should I open a separate issue or is this most likely an issue on my end?

@vpavic
Copy link
Contributor Author

vpavic commented Nov 2, 2018

Should I open a separate issue or is this most likely an issue on my end?

Please do - things get lost quite easily in comments on close issues. When you do that try to provide as much info as possible, and ideally, a minimal, complete, and verifiable example. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: redis type: backport An issue that is a backport of another issue to a maintenance branch type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants