-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Debugger protocol hangs in some special situations #4597
Comments
This is issue for node 5.4 |
I found this issue because I was seeing frequent crashes of node when trying to debug, which I took to be this issue: #4322 Originally, I was using 5.3.0 (latest from homebrew) and can confirm it also happens in 4.2.6 (the current node4-lts version, also via homebrew). I cherry-picked only the small applied fix for the segfaults: #4328 onto a checkout of the 4.2.6 branch and now I get the symptoms from this issue instead (my debugger hangs frequently instead of crashing frequently). I haven't waded into the debugging protocol code yet, but my current suspicion is that the early return added to dodge the segfault is causing the hangs. Previously, the Agent::MessageHandler always took a message and enqueued a new message, but now it sometimes does nothing, which definitely sounds like the kind of change that could cause a hang (a message to which no response is sent). It may also be at the root of this issue: #4651, but I haven't tried a before/after test with the segfault fix above for that, yet. |
perhaps the fix in #4819 might help with this |
@thealphanerd Just as added confirmation, if I also apply your commit in #4819 to my v4.2.6 branch and rebuild, I can successfully debug the code that originally was crashing and later hanging. I don't know how much longer the 4.2.x branch is slated to live, but those two patches seem like candidates for inclusion in the next dot. Thanks! It's great to have debugging more stable again. |
@3y3 I ended up having to do quite a bit of modifications to get the test in a place where I felt it was ready to be submitted to core. For now I'm going to squash it into my existed PR to minimize the number of commits (easier to backport). Let me know if you have a problem with that. |
@thealphanerd One update: it was nagging me that I hadn't ever tested your "do not incept debug context" change in isolation, so I made a new v4.2.6 branch, built and reproduced the crash, then applied just your fix and rebuilt. It neither crashed nor hung, so the original nullptr check to dodge the crash does not appear to be necessary. I don't know if there are other cases it fixes, but it might even be worth backing it out so that if a null environment slips through again, it'll fail noisily. |
@thealphanerd , thank you for fixing this bug! I'm not pretend to be author of test. |
The fix is now in master, you should expect this to see it in a release in the next 2 - 3 weeks on v4 and v5. |
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in #4815 Fixes: #4440 Fixes: #4815 Fixes: #4597 Fixes: #4952 PR-URL: #4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in #4815 Fixes: #4440 Fixes: #4815 Fixes: #4597 Fixes: #4952 PR-URL: #4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
The fix is now released in v5.6.0. Expect LTS next week |
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in #4815 Fixes: #4440 Fixes: #4815 Fixes: #4597 Fixes: #4952 PR-URL: #4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in nodejs#4815 Fixes: nodejs#4440 Fixes: nodejs#4815 Fixes: nodejs#4597 Fixes: nodejs#4952 PR-URL: nodejs#4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in nodejs#4815 Fixes: nodejs#4440 Fixes: nodejs#4815 Fixes: nodejs#4597 Fixes: nodejs#4952 PR-URL: nodejs#4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in nodejs#4815 Fixes: nodejs#4440 Fixes: nodejs#4815 Fixes: nodejs#4597 Fixes: nodejs#4952 PR-URL: nodejs#4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
The fix is now in lts on v4.3.1 ! |
Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in nodejs#4815 Fixes: nodejs#4440 Fixes: nodejs#4815 Fixes: nodejs#4597 Fixes: nodejs#4952 PR-URL: nodejs#4815 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This test fails because we don't receive nothing except first startup message
But if I change console.log arguments in line 2 - all works fine:
The text was updated successfully, but these errors were encountered: