-
Notifications
You must be signed in to change notification settings - Fork 592
fix: access nullptr issue in LoadClusterNodes #2820
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
Conversation
53b848e to
48d4c80
Compare
|
|
@RiversJin, do you mean the null pointer may happen on this line? https://github.com/apache/kvrocks/blob/231b093c979ab80c11ac5433e52d43213dc94840/src/cluster/cluster.cc#L214C24-L214C37 |
|
By the way, anyway we should return error/emit log rather than coredump on access nullptr? Can we add some guard in visiting the pointer? |
|
@RiversJin Seems it has been checked if the |
Oops, it seems I've mixed up the differences between the private code of my current company and the community code .. |
|
@RiversJin Yes, but I think this PR could also be merged since it would be better to move it before loading the cluster node. |



The sequence
LoadClusterNodes->SetClusterNodes->SetMasterSlaveRepl->srv_->slot_migrator->SetStopMigrationFlagcauses a null pointer access during initialization. The fix involves moving the initialization of slot_migrator earlier to resolve this issue.PS: I'sorry that the logic where
SetClusterNodesaccesses slot_migrator was my modification, meaning I introduced this bug. :P