Skip to content

Commit d8e3f86

Browse files
GregoryComerfacebook-github-bot
authored andcommitted
Allow graceful handling of cpuinfo init failure
Summary: Don't fatally assert when cpuinfo_initialize fails. This can happen in rare cases on weird hardware. This change instead logs an error and allows execution to continue without the threadpool. Differential Revision: D74604740
1 parent e3a6825 commit d8e3f86

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

extension/threadpool/threadpool.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ void ThreadPool::run(
9696
// get_threadpool is not thread safe due to leak_corrupted_threadpool
9797
// Make this part threadsafe: TODO(kimishpatel)
9898
ThreadPool* get_threadpool() {
99-
ET_CHECK_MSG(cpuinfo_initialize(), "cpuinfo initialization failed");
99+
if (!cpuinfo_initialize()) {
100+
ET_LOG(Error, "cpuinfo initialization failed");
101+
return nullptr;
102+
}
103+
100104
int num_threads = cpuinfo_get_processors_count();
101105
/*
102106
* For llvm-tsan, holding limit for the number of locks for a single thread

0 commit comments

Comments
 (0)