Conversation
request_queue_ is only assigned on the IO thread and may still be null when Start() checks Expired(). Return nullptr there and guard the destructor, which runs on that failure path. Signed-off-by: Aaron Lichtman <alichtman@meta.com>
|
Review requested:
|
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66201 +/- ##
==========================================
- Coverage 90.30% 90.28% -0.02%
==========================================
Files 790 789 -1
Lines 272044 272878 +834
Branches 51934 52108 +174
==========================================
+ Hits 245671 246375 +704
- Misses 16875 16968 +93
- Partials 9498 9535 +37
🚀 New features to boost your workflow:
|
legendecas
left a comment
There was a problem hiding this comment.
Line 271 in 3cd2d6e
This waits on the InspectorIo::ThreadMain to signal that the InspectorIo has started and initialized request_queue_. I'm not convinced that the condition described is a valid condition.
|
Hey! Thanks for taking a look :) I could totally be wrong, and this is my first I'm looking at a VS Code crash (unfortunately I can't share the entire minidump bc it happened in a production env), but here's an excerpt that I can share: It's an ARM64 machine. Looking at Am I misinterpreting this? Is there any serious downside to merging this? I think the worst case outcome is that the null check is unnecessary, and we lose a fraction of a millisecond on an extra instruction. (But I might be missing something.) |
Merging a patch without understanding the problem accumulates tech debt on the project. Looking at the crash backtrace, I don't think this patch fixes it. The problem seems to me that the InspectorIo::InspectorIo(std::shared_ptr<MainThreadHandle> main_thread,
const std::string& path,
std::shared_ptr<ExclusiveAccess<HostPort>> host_port,
const InspectPublishUid& inspect_publish_uid)
: main_thread_(main_thread),
host_port_(host_port),
inspect_publish_uid_(inspect_publish_uid),
thread_(),
script_name_(path),
id_(GenerateID()) {
Mutex::ScopedLock scoped_lock(thread_start_lock_);
CHECK_EQ(uv_thread_create(&thread_, InspectorIo::ThreadMain, this), 0);
- thread_start_condition_.Wait(scoped_lock);
+ while (request_queue_ == nullptr)
+ thread_start_condition_.Wait(scoped_lock);
}Would you like to apply the fix? |
This reverts commit 9e4757a. Signed-off-by: Aaron Lichtman <alichtman@meta.com>
|
Thanks for the help :) updated! |
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> Assisted-by: Codex
6afe2c7 to
05eeb2e
Compare
|
Fixed format-cpp lint |
request_queue_is only assigned on the IO thread and may still be null whenStart()checksExpired(). Returnnullptrthere and guard the destructor, which runs on that failure path.