GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [fix][broker] Fix one potential to add duplicated consumer by TakaHiR07 · Pull Request #20583 · apache/pulsar Conversation
|
|
You say in the linked issue and you have seen this twice. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I guess this is one of the possibilities for duplicated consumer. And this pr is corresponding to our production case. I can't affirm the duplicated consumer problem do not occur anymore. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@poorbarcode @eolivelli @lhotari @congbobo184 Can you help review this pr? It is another possibilities besides #15051 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ServerError error = getErrorCodeWithErrorLog(existingConsumerFuture, true, | ||
| String.format("Consumer subscribe failure. remoteAddress: %s, subscription: %s", | ||
| remoteAddress, subscriptionName)); | ||
| consumers.remove(consumerId, existingConsumerFuture); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There are three clients in your example, the pulsar client maintains its own connection pool, which means the client1 will not use the same connection as client2 or client3.
The code you changed is the code of ServerCnx(this object is not shared across multi clients), so it will not affect other consumers of other clients
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Additional background:
If you have two pulsar clients, the consumers registered will be like this:
ServerCnx)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
So only consumer-1 and consumer-2 can be in conflict since their consumer-id is not the same, so all things are OK.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess it is one client request three times. Because in our server log, "Subscribing on topic" occur three times in a short time from the same remoteAddress host:ip. Therefore they are in the same connection ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess it is one client request three times. Because in our server log, "Subscribing on topic" occur three times in a short time from the same remoteAddress host:ip. Therefore they are in the same connection ?
could you provide the logs?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
By the log, we can not confirm if these three consumers are the same, because we can not know their consumer id. This log was been improved in the PR https://github.com/apache/pulsar/pull/20568/files#diff-1e0e8195fb5ec5a6d79acbc7d859c025a9b711f94e6ab37c94439e99b3202e84R1168
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| 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?
step-4 and after step-4, there are two different connectionsreq-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
consumer list, see: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L203. I think you can write a test to reproduce this case.req-1 runs at the second connection, all things are OK. Just like the comment above [fix][broker] Fix one potential to add duplicated consumer #20583 (comment)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
BTW, there is a PR trying to fix the concurrent call subscribe in the same client
I still think the current PR is trying to solve this issue is meaningful, and it would be nice to have a test that can reproduce it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7bbfba5 to
e4f561b
Compare
e4f561b to
fbebced
Compare
There was an error while loading. Please reload this page.
|
Add a test to verify this concurrent case and the fix. PTAL, thanks. @codelipenghui @eolivelli @lhotari @poorbarcode |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The pr had no activity for 30 days, mark with Stale label. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I had the same problem on flink task and got fixed after trying this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@poorbarcode @codelipenghui It seems this problem is not fixed in the master branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
#22283 has fixed the same problem. Close this pr. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug] [broker] subscription of topic in a permanent fence state and consumerList remain offline consumer
There was an error while loading. Please reload this page.