vesoft-inc / nebula

A distributed, fast open-source graph database featuring horizontal scalability and high availability
https://nebula-graph.io
Apache License 2.0
10.83k stars 1.2k forks source link

fix. stats manager may cause crash when stats with new labels. #5933

Open UndefinedSy opened 3 months ago

UndefinedSy commented 3 months ago

What type of PR is this?

What problem(s) does this PR solve?

Issue(s) number:

5932

Description:

when continuously adding new labels to statsManager's nameMap, one may crash on using the previously returned iterator from nameMap.

How do you solve it?

using read lock to protect the iterator returned from sm.nameMap_, which is a std::unordered_map.

Special notes for your reviewer, ex. impact of this fix, design document, etc:

process will not crash on using statsManager.

Checklist:

Tests:

Affects:

Release notes:

Fixed the bug that process crashes on concurrent accessing stats manager's nameMap_.