spring-projects / spring-projects/spring-session
Spring sessigon takes up a lot of cpu
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
Hi,We use the spring environment in the current network environment, usually no problem, but the beginning of the month, the amount of users is very large, there will be this exception.
did not handle the exception.java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method) ~[?:1.7.0_79]
at java.lang.Thread.start(Thread.java:714) ~[?:1.7.0_79]
at org.springframework.core.task.SimpleAsyncTaskExecutor.doExecute(SimpleAsyncTaskExecutor.java:230) ~[spring-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.core.task.SimpleAsyncTaskExecutor.execute(SimpleAsyncTaskExecutor.java:188) ~[spring-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.core.task.SimpleAsyncTaskExecutor.execute(SimpleAsyncTaskExecutor.java:167) ~[spring-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.data.redis.listener.RedisMessageListenerContainer.dispatchMessage(RedisMessageListenerContainer.java:965) ~[spring-data-redis-1.7.1.RELEASE.jar:?]
at org.springframework.data.redis.listener.RedisMessageListenerContainer.access$1400(RedisMessageListenerContainer.java:72) ~[spring-data-redis-1.7.1.RELEASE.jar:?]
at org.springframework.data.redis.listener.RedisMessageListenerContainer$DispatchMessageListener.onMessage(RedisMessageListenerContainer.java:956) ~[spring-data-redis-1.7.1.RELEASE.ja
r:?] at org.springframework.data.redis.connection.lettuce.LettuceMessageListener.message(LettuceMessageListener.java:44) ~[spring-data-redis-1.7.1.RELEASE.jar:?]
at org.springframework.data.redis.connection.lettuce.LettuceMessageListener.message(LettuceMessageListener.java:30) ~[spring-data-redis-1.7.1.RELEASE.jar:?]
at com.lambdaworks.redis.pubsub.RedisPubSubConnectionImpl.notifyListeners(RedisPubSubConnectionImpl.java:164) ~[lettuce-3.5.0.Final.jar:?]
at com.lambdaworks.redis.pubsub.RedisPubSubConnectionImpl.channelRead(RedisPubSubConnectionImpl.java:133) ~[lettuce-3.5.0.Final.jar:?]
at com.lambdaworks.redis.RedisChannelHandler.channelRead(RedisChannelHandler.java:90) ~[lettuce-3.5.0.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at com.lambdaworks.redis.pubsub.PubSubCommandHandler.decode(PubSubCommandHandler.java:61) ~[lettuce-3.5.0.Final.jar:?]
at com.lambdaworks.redis.protocol.CommandHandler.channelRead(CommandHandler.java:153) ~[lettuce-3.5.0.Final.jar:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:321) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1280) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:328) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:890) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:564) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:505) ~[netty-transport-4.0.37.Final.jar:4.0.37.Final]^C
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the stack-trace entry points in SimpleAsyncTaskExecutor and RedisMessageListenerContainer, then inspect how LettuceMessageListener dispatches messages. Reproduce the beginning-of-month, high-user load described in the issue and determine whether thread creation remains bounded; done means the exception no longer occurs under that load.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100