poorbarcode commented on code in PR #20583:
URL: https://github.com/apache/pulsar/pull/20583#discussion_r1231938700
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1184,7 +1184,6 @@ protected void handleSubscribe(final CommandSubscribe
subscribe) {
ServerError error =
getErrorCodeWithErrorLog(existingConsumerFuture, true,
String.format("Consumer subscribe failure.
remoteAddress: %s, subscription: %s",
remoteAddress, subscriptionName));
- consumers.remove(consumerId, existingConsumerFuture);
Review Comment:
| time | `req-1` | `req-2` | `close connection` |
| --- | --- | --- | --- |
| 1 | | put a new `consumerFuture` |
| 2 | | | close connection |
| 3 | | | mark the `consumerFuture` as failed |
| 4 | | | close the connection |
| 5 | got `consumerFuture`(failed) |
| 6 | remove the failed future |
| 7 | | add the consumer into the list and set(`list.size = 1` and `set.size
= 1`) |
| 8 | put the second `consumerFuture` | |
| 9 | add the second consumer into the list and set(`list.size = 2` and
`set.size = 1`) |
| 10 | | remove the consumer from the list and set(`list.size = 1` and
`set.size = 0`) |
Do you want to say the three requests executed as above?
- before the `step-4` and after `step-4`, there are two different connections
- if the `req-1` runs at the first connection, it will trigger another
`consumer.close`. see:
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L896
- But maybe left an orphan consumer in the `consumer list`, see:
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L203
- if the `req-1` runs at the second connection, all things are OK. Just like
the comment above
https://github.com/apache/pulsar/pull/20583#discussion_r1231873184
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]