Skip to content

Commit 6afe2c7

Browse files
committed
inspector: handle spurious wakeups in InspectorIo startup
The constructor waited on thread_start_condition_ without a predicate, so a spurious wakeup could let it return before the IO thread assigned request_queue_, leading to a null dereference in Start(). Loop until request_queue_ is set. Signed-off-by: Aaron Lichtman <alichtman@meta.com>
1 parent 7680075 commit 6afe2c7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/inspector_io.cc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ InspectorIo::InspectorIo(std::shared_ptr<MainThreadHandle> main_thread,
268268
id_(GenerateID()) {
269269
Mutex::ScopedLock scoped_lock(thread_start_lock_);
270270
CHECK_EQ(uv_thread_create(&thread_, InspectorIo::ThreadMain, this), 0);
271-
thread_start_condition_.Wait(scoped_lock);
271+
while (request_queue_ == nullptr)
272+
thread_start_condition_.Wait(scoped_lock);
272273
}
273274

274275
InspectorIo::~InspectorIo() {

0 commit comments

Comments
 (0)