[
https://issues.apache.org/jira/browse/GEODE-8333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17175663#comment-17175663
]
ASF GitHub Bot commented on GEODE-8333:
---------------------------------------
dschneider-pivotal commented on a change in pull request #5420:
URL: https://github.com/apache/geode/pull/5420#discussion_r468688937
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/netty/ExecutionHandlerContext.java
##########
@@ -138,6 +161,25 @@ public void exceptionCaught(ChannelHandlerContext ctx,
Throwable cause) {
writeToChannel(getExceptionResponse(ctx, cause));
}
+ public EventLoopGroup getSubscriberGroup() {
+ return subscriberGroup;
+ }
+
+ public synchronized void changeChannelEventLoopGroup(EventLoopGroup
newGroup, Runnable callback) {
+ if (newGroup.equals(channel.eventLoop())) {
+ // already registered with newGroup
+ return;
+ }
+ channel.deregister().addListener((ChannelFutureListener) future -> {
+ synchronized (channel) {
Review comment:
I question if the synchronization here is correct. I'd like to walk
through it with you to understand it better
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/netty/ExecutionHandlerContext.java
##########
@@ -80,31 +86,57 @@
* @param password Authentication password for each context, can be null
*/
public ExecutionHandlerContext(Channel channel, RegionProvider
regionProvider, PubSub pubsub,
- EventLoopGroup subscriberGroup,
Supplier<Boolean> allowUnsupportedSupplier,
Runnable shutdownInvoker,
RedisStats redisStats,
+ ExecutorService backgroundExecutor,
+ EventLoopGroup subscriberGroup,
byte[] password) {
this.channel = channel;
this.regionProvider = regionProvider;
this.pubsub = pubsub;
- this.subscriberGroup = subscriberGroup;
this.allowUnsupportedSupplier = allowUnsupportedSupplier;
this.shutdownInvoker = shutdownInvoker;
this.redisStats = redisStats;
+ this.subscriberGroup = subscriberGroup;
this.client = new Client(channel);
this.byteBufAllocator = this.channel.alloc();
this.authPassword = password;
this.isAuthenticated = password == null;
redisStats.addClient();
- }
- public ChannelFuture writeToChannel(ByteBuf message) {
- return channel.writeAndFlush(message, channel.newPromise());
+ backgroundExecutor.submit(this::processCommandQueue);
}
public ChannelFuture writeToChannel(RedisResponse response) {
- return channel.writeAndFlush(response.encode(byteBufAllocator),
channel.newPromise());
+ return channel.writeAndFlush(response.encode(byteBufAllocator),
channel.newPromise())
+ .addListener((ChannelFutureListener) f -> {
Review comment:
it is rare that response will have an afterWrite listener or that debug
logging will be enabled. It seems like we could save some work here by not
adding a listener for every single write. Couldn't we test if debug is enabled
or if the response has an afterWrite listener and only in that case add the
listener?
##########
File path:
geode-redis/src/distributedTest/java/org/apache/geode/redis/internal/executor/pubsub/PubSubDUnitTest.java
##########
@@ -381,6 +446,7 @@ public void testPubSubWithManyClientsDisconnecting() throws
Exception {
// Abnormally close and recreate new subscribers without unsubscribing
for (int i = 0; i < ITERATIONS; i++) {
int candy = random.nextInt(CLIENT_COUNT);
+ // int localI = i;
Review comment:
remove this deadcode
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Fix PUBSUB hang
> ---------------
>
> Key: GEODE-8333
> URL: https://issues.apache.org/jira/browse/GEODE-8333
> Project: Geode
> Issue Type: Bug
> Components: redis
> Reporter: Sarah Abbey
> Assignee: Darrel Schneider
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.14.0
>
>
> PUBSUB hangs with concurrent publishers and subscribers on multiple servers.
> The initial fix is being reverted because it caused a bug in which responses
> to clients could now be out of order.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)