-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inspector: fix inspector::Agent::HasConnectedSessions #20614
Conversation
It is possible to build Node without the inspector. Should that mode be used for embedding? |
@eugeneo Thanks for the quick response! |
I am still not comfortable with this fix, because it means the rest of the Node is unaware that the inspector might be missing. I assume the issue you are facing is because of WaitForInspectorDisconnect call in node.cc. Would it be possible not to call it instead? I think we should not reference env->inspector_agent at all if the Inspector is not properly setup. |
Thanks for the suggestion, but I am not calling WaitForInspectorDisconnect. LoadEnvironment(&env); |
Then it looks like console should not be pinging inspector when the inspector is n/a. IMHO, the best fix would still be to compile without the inspector altogether if it is not needed. Anyway, I will not be blocking this PR. |
@helloshuangzi try |
@eugeneo I know that flag, and it did help embedding scenarios if it works, but not for addon scenarios. Because the addon will depend on a self-built node to run it. It would be a significant drawback if an addon can't run with the official release version of node.js. |
@eugeneo I think that’s not a viable long-term solution for embedders. |
@addaleax inspector::Agent::Start should always be called if the inspector::Agent instance had been created (i.e. if the Node was built with the inspector support). I will work on that fix when I have some time. As I said, I am not blocking this PR. |
I noticed there were unsuccessful checks in the last CI, which can also be found for other PRs yesterday. I think it may got fixed by newly landed commits, so I just rebased it by the latest master. Please let me know if I should not do this after a collaborator started CI. |
Landed in 34ca9f3 |
PR-URL: #20614 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #20614 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#20614 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
In Agent::HasConnectedSessions, return false if client_ is nullptr.
That's possible when inspector setting is skipped for embedding/addon scenarios.
It makes the code more robust at least, otherwise, crash will happen here.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes