Node.js issue with Math.log exiting immediately

86 views
Skip to first unread message

JF Robichaud

unread,
Sep 2, 2015, 6:29:27 PM9/2/15
to nodejs
Hi,

I originally posted this issue on stackoverflow here

After following up through comments over there I was able to discover that my %errorlevel% is set to a negative value.  The only reference to this I have found in reference to node was because of node segfaulting so I decided to post here to perhaps get more traction.

I was doing some work with Gulp and pushed my tasks to our Windows 2008 R2 server where they strangely stopped working. 

The tasks are just exiting at a certain point and return me to prompt.  Everything is working fine on my Windows 7 dev machine and on one Windows 2008 R2 server, so far the issue is only occuring on our development Windows 2008 R2 server

Through isolation, I was able to narrow it down to the module Pretty bytes which uses Math.log in its calculation. I tried to use Math.log directly from node and I get the same result on that one server. It looks like Math.log is broken, however other Math functions work just fine.

Reproduction steps below:

Details:

    2 different Windows 2008 R2 running in a VM (if that's important)
    node v0.12.7

    //nodemathtest.js
    console
.log(process.versions);
    console
.log("before");
    console
.log(Math.floor(2.2));
    console
.log(Math.log(10));
    console
.log("after");

Running
node mathlogtest.js

On one my machine and on one Windows 2008 R2 server I get the expected result:

    C:\>node mathlogtest.js
    { http_parser: '2.3',
      node
: '0.12.7',
      v8
: '3.28.71.19',
      uv
: '1.6.1',
      zlib
: '1.2.8',
      modules
: '14',
      openssl
: '1.0.1p' }
    before
   
2
   
2.302585092994046
    after


On our development Windows server where the Gulp tasks are exiting prematurely I get this:

    C:\>node mathlogtest.js
    { http_parser: '2.3',
      node
: '0.12.7',
      v8
: '3.28.71.19',
      uv
: '1.6.1',
      zlib
: '1.2.8',
      modules
: '14',
      openssl
: '1.0.1p' }
    before
   
2
   
    C:\>

I can see that Math.log is causing Node to exit immediately back to prompt which is also what's happening from Gulp, I get kicked back to my prompt and the task is interrupted.

After this running echo %ERRORLEVEL% returns -1073741795 on the faulty server, 0 where it's successful.

I'm not exactly sure where to look as I'm fairly new to Node.  From my understanding Node is using Chrome's V8 JS engine and `process.version` is returning exactly the same on each server.  I've tried to install .NET 4.5.1 and various C++ redistributable package to no avail.


JF Robichaud

unread,
Sep 3, 2015, 11:10:04 AM9/3/15
to nodejs
I've compiled my own version with vcbuild debug nosign x64 using the binary from that I get no errors and get the expected results. 

I initially installed Node using Chocolatey so I thought it could be related to my strange result, I've uninstalled that one and re-installed Node using the official installer but the issue remain.  For now I can use the debug version I've compiled, but not sure exactly what is different in that one.  If anyone is interested in seeing the binary or have ideas as to what could cause this I can provide the binary if you wish.

Cheers!

--
JF

Rick Waldron

unread,
Sep 3, 2015, 12:01:50 PM9/3/15
to nodejs
Math.log is defined in v8, not node, so I'd say build v8 from source on that machine and see if it repros. https://chromium.googlesource.com/v8/v8.git/+/master/src/math.js
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/7e1054a9-b9d6-473f-b141-ce5ab4b6c73b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JF Robichaud

unread,
Sep 3, 2015, 5:43:04 PM9/3/15
to nodejs
I recompiled node from source in Release mode (which I assume also builds v8?) and the issue went away.

The binary for node is smaller than the one installed by the NodeJS installer which seems strange to me but at least it's working now.  Not exactly sure why it's different now as my version of V8 stayed the same with the recompile.  Could be some compile flags that are different for the installer I suppose?

process.versions still returns the same : v8: '3.28.71.19',

--
JF
Reply all
Reply to author
Forward
0 new messages