Skip to content
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

funky behavior inside Proxy handler function #6464

Closed
rusintez opened this issue Apr 29, 2016 · 8 comments
Closed

funky behavior inside Proxy handler function #6464

rusintez opened this issue Apr 29, 2016 · 8 comments
Labels
confirmed-bug Issues with confirmed bugs. util Issues and PRs related to the built-in util module.

Comments

@rusintez
Copy link

  • Version: 6.0.0
  • Platform: darwin
  • Subsystem: 10.11

screen shot 2016-04-29 at 14 53 46

@rusintez
Copy link
Author

screen shot 2016-04-29 at 15 00 55

@jasnell jasnell added confirmed-bug Issues with confirmed bugs. util Issues and PRs related to the built-in util module. labels Apr 29, 2016
@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

Confirmed, it seems that util.inspect doesn't know what to make of Proxy objects in certain cases... will look into it.

@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

The issue here is that the firstthird argument passed to get is the proxy object itself. This is passed to console.log() which does a util.inspect(). Now, util.inspect() attempts to walk the properties for the Proxy object, which ends up recursively calling get... which leads to the max call stack error.

jasnell added a commit to jasnell/node that referenced this issue Apr 29, 2016
In certain conditions, inspecting a Proxy object can lead to a
max call stack error. Avoid that by detecting the Proxy object
and outputting information about the Proxy object itself.

Also adds util.isProxy()

Fixes: nodejs#6464
@rusintez
Copy link
Author

👍

@rusintez
Copy link
Author

Any ideas about arguments[2] in the last screenshot?

@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

Yes, I just realized in my comment above I mentioned the wrong argument... the third argument passed to get is the proxy object. Look here .. the get argument is passed three arguments, the target, the property name and the proxy.

@its2mc
Copy link

its2mc commented May 2, 2016

Hey.. I modified the function a bit and got a random output that I do not fully understand..
var a = new Proxy({}, {get:(arg)=>(console.log(arg),5)});
The output is
image

@its2mc
Copy link

its2mc commented May 2, 2016

Is it recursive because the object itself is the argument? , is this a loop structure? I mean is the arrow function recursive.

@jasnell jasnell closed this as completed in ba6196f May 3, 2016
Fishrock123 pushed a commit that referenced this issue May 4, 2016
In certain conditions, inspecting a Proxy object can lead to a
max call stack error. Avoid that by detecting the Proxy object
and outputting information about the Proxy object itself.

Fixes: #6464
PR-URL: #6465
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
joelostrowski pushed a commit to joelostrowski/node that referenced this issue May 4, 2016
In certain conditions, inspecting a Proxy object can lead to a
max call stack error. Avoid that by detecting the Proxy object
and outputting information about the Proxy object itself.

Fixes: nodejs#6464
PR-URL: nodejs#6465
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

No branches or pull requests

3 participants