Skip to content

Conversation

@GOGOYAO
Copy link
Contributor

@GOGOYAO GOGOYAO commented Oct 9, 2019

Fixed: add mutex for cpu_info init() to prevent random core dump caused by init() in multi threads.

@GOGOYAO GOGOYAO closed this Oct 9, 2019
@GOGOYAO GOGOYAO reopened this Oct 9, 2019
@GOGOYAO GOGOYAO closed this Oct 9, 2019
@GOGOYAO GOGOYAO reopened this Oct 9, 2019
Copy link
Contributor

@imay imay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't find the root cause. You'd better look into it again.

unique_ptr<int[]> CpuInfo::core_to_numa_node_;
vector<vector<int>> CpuInfo::numa_node_to_cores_;
vector<int> CpuInfo::numa_node_core_idx_;
pthread_mutex_t CpuInfo::init_mutex_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. we don't need this lock, because CpuInfo is only initialized in main function.
  2. even if we need a lock, std::mutex is preferred.
  3. you don't call pthread_mutex_init() to initialize this variable, it will lead process crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This problem has been fixed in 1826 with same way, in which use a mutex to lock when init(). So I close this now.

@GOGOYAO GOGOYAO closed this Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants