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

RedisCache Remove Blocking IO on Event Loop Thread #18

Merged
merged 1 commit into from
Oct 14, 2019

Conversation

hmatt1
Copy link
Contributor

@hmatt1 hmatt1 commented Oct 11, 2019

The RedisCache constructor was making 2 calls that run the Redis command command to get a list of commands.

  • new RedisAsyncCache();
  • syncCommands(this.connection);

This blocking command is being run from a Netty Event Loop Group thread where the constructor is called, which causes problems since nioEventLoopGroup threads should not have any blocking calls run on them.

The `RedisCache` constructor was making 2 calls that run the Redis command `command` to get a list of commands.

This blocking command is being run from a Netty Event Loop Group thread where the constructor is called, which causes problems since `nioEventLoopGroup` threads should not have any blocking calls run on them.
@hmatt1
Copy link
Contributor Author

hmatt1 commented Oct 11, 2019

Just to post a little more background, the reason I started down this path is that we got a io.lettuce.core.RedisCommandTimeoutException when trying to instantiate the bean, and then I found this comment redis/lettuce#784 (comment) which sounded like the same thing.

Also, to update this PR with info from the conversation in the Gitter channel, @jameskleeh and I were discussing needing to make getCommands and getAsync thread safe, as well as if CompletableFuture.supplyAsync was the right thing to use to avoid blocking the event loop thread.

@graemerocher graemerocher merged commit 9b32c20 into micronaut-projects:master Oct 14, 2019
@graemerocher
Copy link
Contributor

Thanks for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants