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

ToString(Object) sometimes returns [object Null] #12411

Closed
Sebmaster opened this issue Apr 14, 2017 · 11 comments
Closed

ToString(Object) sometimes returns [object Null] #12411

Sebmaster opened this issue Apr 14, 2017 · 11 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@Sebmaster
Copy link
Contributor

Sebmaster commented Apr 14, 2017

  • Version: 7.7.1
  • Platform: Linux web 4.4.0-18-generic #34~14.04.1-Ubuntu SMP Thu Apr 7 18:31:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: v8

I think we're encountering this bug in our staging and prod environments under heavy load. It does not occur in node v6, but only v7.

I can't reproduce this in the node console (with the v8 repro), but it seems like the v8 code is the same in node.

Is it possible to somehow verify this also applies to node and backport that v8 fix into node v7?

@mscdex mscdex added v7.x v8 engine Issues and PRs related to the V8 dependency. question Issues that look for answers. labels Apr 14, 2017
@mscdex
Copy link
Contributor

mscdex commented Apr 14, 2017

I don't think it's out of the ordinary, seeing as how null is considered an object type in Javascript. For example:

> Object.prototype.toString.call(null)
'[object Null]'

It could be a bug though whose fix didn't get backported to 5.5 though.

@Sebmaster
Copy link
Contributor Author

Sebmaster commented Apr 14, 2017

This is not about what happens when you stringify null.[object Null] is returned when you stringify an ordinary object. See also this Stackoverflow, which has a great log of the behaviour of the object.

Also see in the linked v8 issue where an array is stringified, but [object Null] gets returned (in full codegen, seems to be fixed in ignition).

@bnoordhuis
Copy link
Member

The V8 in v7.x has the same bug. I'll prepare a back-port.

@bnoordhuis
Copy link
Member

#12412

@holm
Copy link

holm commented Apr 14, 2017

This has been troubling us for months! So happy the issue has been found. Getting the fix out in a patch release soon would be great for us. Thanks.

@addaleax
Copy link
Member

@holm I would assume we do another v7.x patch release next week, as usual.

@holm
Copy link

holm commented Apr 15, 2017

Great, thanks a lot for the quick work (as usual)!

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Apr 19, 2017
This is a chery-pick if you consider reducing the context to -C2
a cherry-pick; WordIsSmi has been renamed to TaggedIsSmi upstream.

Original commit message:

    [builtins] Fix pointer comparison in ToString builtin.

    This fixes the bogus {Word32Equal} comparison in the ToString
    builtin implementing Object.prototype.toString to be a pointer-size
    {WordEqual} comparison instead. Comparing just the lower half-word
    is insufficient on 64-bit architectures.

    R=jgruber@chromium.org
    TEST=mjsunit/regress/regress-crbug-664506
    BUG=chromium:664506

    Review-Url: https://codereview.chromium.org/2496043003
    Cr-Commit-Position: refs/heads/master@{nodejs#40963}

Fixes: nodejs#12411
PR-URL: nodejs#12412
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@bnoordhuis
Copy link
Member

Fixed in f882f47, should be in the next v7.x release.

@holm
Copy link

holm commented Apr 27, 2017

Any idea when the next v7.x release might be? This bug is hurting us quite a bit, and a new release would be wonderful. Thanks as always.

@bnoordhuis
Copy link
Member

Next Tuesday, I think. I'm not on the release team though.

@evanlucas
Copy link
Contributor

Ben is correct. I have a release almost ready but decided to hold off due to #12663

evanlucas pushed a commit that referenced this issue May 1, 2017
This is a chery-pick if you consider reducing the context to -C2
a cherry-pick; WordIsSmi has been renamed to TaggedIsSmi upstream.

Original commit message:

    [builtins] Fix pointer comparison in ToString builtin.

    This fixes the bogus {Word32Equal} comparison in the ToString
    builtin implementing Object.prototype.toString to be a pointer-size
    {WordEqual} comparison instead. Comparing just the lower half-word
    is insufficient on 64-bit architectures.

    R=jgruber@chromium.org
    TEST=mjsunit/regress/regress-crbug-664506
    BUG=chromium:664506

    Review-Url: https://codereview.chromium.org/2496043003
    Cr-Commit-Position: refs/heads/master@{#40963}

Fixes: #12411
PR-URL: #12412
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

6 participants