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

ClientServiceIndexesManager 在极端场景下,数据可能和ClientManager不一致 #10556

Closed
KomachiSion opened this issue May 26, 2023 · 1 comment · Fixed by #10557
Closed
Labels
area/Naming kind/bug Category issues or prs related to bug.
Milestone

Comments

@KomachiSion
Copy link
Collaborator

Describe the bug
ClientManager stored each client register and subscribe which services, which is client to service index. for most of query situation, we prefer to get all service instances or subsribers which is service to client.

So ClientServiceIndexesManager is the index manager of transfering client to service to service to client.

But in some situation, there is one problem for concurrent handle ClientEvent.ClientDisconnectEvent and ClientOperationEvent.ClientRegisterServiceEvent.

For example:

Client A is disconnect first, and at the same time, the client also redo register to nacos. It will has an order for disconnect and register. whatever the order is, we expect the event handled in ClientServiceIndexesManager can be the same order.

Client A disconnect --> Client A redo register --> publish ClientDisconnectEvent --> ClientRegisterServiceEvent

But The two event are ClientEvent based and ClientOperationEvent based, which will be handled in EventCenter by two different query and thread, and no way to force the order between them.

It may cause:
Client A disconnect --> Client A redo register --> ClientRegisterServiceEvent --> publish ClientDisconnectEvent

The case will make the index lost the client A data and not show in console and for subscribe.

The case is hard to disappear, but it's possible

Expected behavior
The index handled order same as the client operation order.

Actually behavior
async handle in some extreme scene.

Additional context
I think we can add an ClientOperationEvent like named releaseData or releaseClient, publish this event at the same time with ClientOperationEvent.ClientRegisterServiceEvent.
And ClientServiceIndexesManager use new event replace ClientOperationEvent.ClientRegisterServiceEvent, it can make the event order same as the operate order.

@wangdongyun
Copy link

这里我理解是不是单点模式容易出现。
集群模式客户端重连会切换到下一台机器上。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Naming kind/bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants