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

object properties change when inspected under specific conditions #8358

Closed
joseph-lansdowne-opentext opened this issue Aug 31, 2016 · 10 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. v8 engine Issues and PRs related to the V8 dependency.

Comments

@joseph-lansdowne-opentext
  • Version: v6.5.0
  • Platform: Linux j-vm 4.6.4-1-ARCH #1 SMP PREEMPT Mon Jul 11 19:12:32 CEST 2016 x86_64 GNU/Linux

Code:

var input1 = { a: 1 }
var input2 = { a: 0.5 }
var result1 = { b: input1.a, weird: +input1.a }

console.log(result1)

var result2 = { b: input2.a, weird: input2.a }

console.log(result1)

Output:

{ b: 1, weird: 1 }
{ b: 1, weird: 0 }

This works correctly on v4.4.3, where the output is:

{ b: 1, weird: 1 }
{ b: 1, weird: 1 }
@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Aug 31, 2016

@joseph-lansdowne-hpe

var input1 = { a: 1 }
var input2 = { a: 0.5 }
var result1 = { b: input1.a, weird: +input1.a } // why `+` ?

console.log(result1)

var result2 = { b: input2.a, weird: input2.a }

console.log(result1) // Do you mean `result2` ?

I get { b: 0.5, weird: 0.5 } on v6.5.0 by console.log(result2)

@joseph-lansdowne-opentext
Copy link
Author

+input1.a seems to be required, not sure why. Other expressions give the same behaviour, such as 1 + input1.a and 2 * input1.a.

No, both console.log lines are supposed to be exactly the same. That's what the bug is - the value of the weird property in the result1 object changes in the line that defines result2.

@vsemozhetbyt
Copy link
Contributor

Can't reproduce on Windows 7:

1

@targos
Copy link
Member

targos commented Aug 31, 2016

I cannot reproduce this bug on OSX either

Edit: also tested on Linux

@ikn
Copy link

ikn commented Aug 31, 2016

I can reproduce on another Arch Linux installation too, this time not a VM (uname -a: Linux j-desktop 4.7.1-1-ARCH #1 SMP PREEMPT Wed Aug 17 08:13:35 CEST 2016 x86_64 GNU/Linux).

@targos targos added the v8 engine Issues and PRs related to the V8 dependency. label Aug 31, 2016
@targos
Copy link
Member

targos commented Aug 31, 2016

cc @nodejs/v8

@addaleax addaleax added confirmed-bug Issues with confirmed bugs. duplicate Issues and PRs that are duplicates of other issues or PRs. and removed confirmed-bug Issues with confirmed bugs. labels Aug 31, 2016
@addaleax
Copy link
Member

I can reproduce the bug locally and confirmed, with GCC 6 on Ubuntu, my patch for #8310 also seems to rectify this. I’m closing this as a duplicate of #8310, because even though the symptoms are a bit different, it still makes sense to me that the underlying issue is the same. Thanks for sending in the bug report!

To mention it for users coming here looking for a solution: You can just use the official Node.js binaries from https://nodejs.org/, use Node 6.4.0 (which seems to only reduce the frequency of the bug, not eliminate it), or compile 6.5.0 from the sources using gcc < 6.

@addaleax
Copy link
Member

Actually, @joseph-lansdowne-hpe your code seems to make a pretty good test case for the bug… would you be interested in trying to submit that to V8?

@joseph-lansdowne-opentext
Copy link
Author

I see from the issue you linked that you've created https://codereview.chromium.org/2292953002/ (which is now closed). Do you mean to mention the test case on that issue? Or to create another issue in the same issue tracker providing my code for potential use in a unit test or something?

@addaleax
Copy link
Member

addaleax commented Sep 1, 2016

@joseph-lansdowne-hpe Sorry for not seeing your message, github’s email notifications seem to be a bit off today. The patch at https://codereview.chromium.org/2292953002/ is the equivalent of a github pull request, the “issues”-issues for V8 are managed at https://bugs.chromium.org/p/v8/issues/list.

I was suggesting you try and put a patch together which contains that test… it takes quite a while to get to know the whole process around that, and I’m still learning myself, but I’d be happy (and I know the others here with more experience are, too) to try and work it out with you. Plus, you’d have contributed code to V8, which is just plain cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants