Fix a cluster controller crash in status server

The logSystemConfig could be changed after the yield(), thus the iterator can
points to invalid memory.

To reproduce with gcc build at commit 3e90644779:
   -f tests/slow/DDBalanceAndRemoveStatus.toml -s 3134372275 -b off
This commit is contained in:
Jingyu Zhou 2024-08-13 15:41:31 -07:00
parent 6d49a76a26
commit 0e93c685b5
1 changed files with 2 additions and 3 deletions

View File

@ -835,9 +835,8 @@ ACTOR static Future<JsonBuilderObject> processStatusFetcher(
}
state std::vector<OldTLogConf>::const_iterator oldTLogIter;
for (oldTLogIter = db->get().logSystemConfig.oldTLogs.begin();
oldTLogIter != db->get().logSystemConfig.oldTLogs.end();
++oldTLogIter) {
state std::vector<OldTLogConf> oldTLogs = db->get().logSystemConfig.oldTLogs;
for (oldTLogIter = oldTLogs.begin(); oldTLogIter != oldTLogs.end(); ++oldTLogIter) {
for (auto& tLogSet : oldTLogIter->tLogs) {
for (auto& it : tLogSet.tLogs) {
if (it.present()) {