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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66201 +/- ##
==========================================
- Coverage 90.30% 90.29% -0.02%
==========================================
Files 790 790
Lines 272044 272531 +487
Branches 51934 52048 +114
==========================================
+ Hits 245671 246075 +404
- Misses 16875 16908 +33
- Partials 9498 9548 +50
🚀 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? |
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.