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

Start HashWheelTimer in ClientResources to avoid blocking calls in EventLoop #1489

Closed
mp911de opened this issue Nov 2, 2020 · 0 comments
Closed
Labels
type: task A general task
Milestone

Comments

@mp911de
Copy link
Collaborator

mp911de commented Nov 2, 2020

HashWheelTimer starts lazily upon creating a new Task. Startup is synchronized and may result in a blocking call:

3:55:17.330 [lettuce-nioEventLoop-76-1] DEBUG io.lettuce.core.protocol.CommandHandler - [unknown, chid=0x1] Unexpected exception during request: reactor.blockhound.BlockingOperationError: Blocking call! jdk.internal.misc.Unsafe#park
reactor.blockhound.BlockingOperationError: Blocking call! jdk.internal.misc.Unsafe#park
    at java.base/jdk.internal.misc.Unsafe.park(Unsafe.java)
    at java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
    at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:885)
    at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1039)
    at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1345)
    at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232)
    at io.netty.util.HashedWheelTimer.start(HashedWheelTimer.java:349)
    at io.netty.util.HashedWheelTimer.newTimeout(HashedWheelTimer.java:416)
    at io.lettuce.core.protocol.RedisHandshakeHandler.channelRegistered(RedisHandshakeHandler.java:65)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRegistered(AbstractChannelHandlerContext.java:166)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRegistered(AbstractChannelHandlerContext.java:152)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRegistered(AbstractChannelHandlerContext.java:145)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRegistered(DefaultChannelPipeline.java:1383)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRegistered(AbstractChannelHandlerContext.java:166)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRegistered(AbstractChannelHandlerContext.java:152)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRegistered(DefaultChannelPipeline.java:815)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:505)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
    at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:834)

We should call HashedWheelTimer.start() when creating DefaultClientResources to start the timer eagerly.

@mp911de mp911de added this to the 6.0.2 milestone Nov 2, 2020
@mp911de mp911de added the type: task A general task label Nov 2, 2020
mp911de added a commit that referenced this issue Nov 2, 2020
…entLoop #1489

We now eagerly start HashWheelTimer when creating DefaultClientResources to avoid blocking calls originating from Timer startup on an EventLoop thread.
mp911de added a commit that referenced this issue Nov 2, 2020
…entLoop #1489

We now eagerly start HashWheelTimer when creating DefaultClientResources to avoid blocking calls originating from Timer startup on an EventLoop thread.
@mp911de mp911de closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

1 participant