-
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
util.format(object) causes node debugger to terminate #4815
Comments
I can confirm I noticed this problem on my machine as well. Appears to have been introduced by 2d5380e |
I can also confirm that the debugger acts as expected on node v4.2.1 but appears to be acting really odd on v5.5.0 and master as well. If you attempt to go to the next line after console.log everything stops working in a really lovely way. |
I can confirm that reverting 2d5380e does indeed fix the problem on v4. The test suite also passes with this change. I attempted to run the unit test suite of log4js using citgm on the affected versions and we get all green. This is an odd one |
I have narrowed it down to this specific line 2d5380e#diff-3deb3f32958bb937ae05c6f3e4abbdf5R322 Seems like inspectPromise is giving a false positive |
Do you know for what object ? |
I'm still digging in here, I was using the provided example
so it would be on |
Ok... I've dug deeper into this one. so far I've gotten far enough to rule out util.js as actually causing the problem. The change to how we were checking promising (simply calling inspectPromise) is ensuring that calls to and the digging continues 😄 edit: going a layer deeper... seems |
So things get kind of odd. I have set up some logging before the call to when you just run the above example
When you run it in debug you get
This is leaving me to believe that the program is exiting before it even calls into the binding. |
So I have a hunch right now that the issue is that we are creating two different Debug Contexts. The call to |
So I think I've gotten to the bottom of things --> https://github.com/nodejs/node/blob/master/src/debug-agent.cc#L122-L128 The debug-agent sets the parent_env to be Later when https://github.com/nodejs/node/blob/master/src/node_contextify.cc#L273 I'm not 100% but I think this may have been introduced by #1229 edit: dug a bit deeper... it seems the problem lies specifically at https://github.com/nodejs/node/blob/master/src/node_contextify.cc#L256 I'm still not familiar enough with c++ to get the subtly of what is going on entirely, but my guess is that this line is tearing down a part of the context that shouldn't be touched if we want to remain in a debug context /cc @bnoordhuis |
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. |
Thanks, Myles. |
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]>
Notable changes: * buffer: make byteLength work with Buffer correctly (Jackson Tian) - nodejs#4738 * debugger: guard against call from non-node context (Ben Noordhuis) - nodejs#4328 * node_contextify: do not incept debug context (Myles Borins) - nodejs#4815
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 is not reproducible in [email protected]. I can repro this in 4.2.5 and 4.2.6.
Ran into this because util.format is how log4js formats log data.
[1] https://github.com/nomiddlename/log4js-node/blob/0fc65d38eb0210bbb2d5bf12b40d3588f7c318e2/lib/layouts.js#L40
The text was updated successfully, but these errors were encountered: