nodejs / node-report

Delivers a human-readable diagnostic summary, written to file.
https://www.npmjs.com/package/node-report
Other
326 stars 45 forks source link

Reported Node.js version is incorrect #29

Closed richardlau closed 7 years ago

richardlau commented 7 years ago

Reports currently contain in the NodeReport section:

Node.js version: v6.9.1
(v8: 5.1.281.84, libuv: 1.9.1, zlib: 1.2.8, ares: 1.10.1-DEV)

If I compile nodereport with one version of Node.js (e.g. v6.9.1) and then run on another version (e.g. v6.7.0) the report incorrectly reports v6.9.1 and not v6.7.0 (note that it correctly reports v8: 5.1.281.83):

-bash-4.2$ node
> process.versions
{ http_parser: '2.7.0',
  node: '6.7.0',
  v8: '5.1.281.83',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '57.1',
  modules: '48',
  openssl: '1.0.2j' }
> require('.').triggerReport()

Writing Node.js report to file: NodeReport.20161124.151013.8560.001.txt
Node.js report completed
'NodeReport.20161124.151013.8560.001.txt'
> .exit
-bash-4.2$ head -20 NodeReport.20161124.151013.8560.001.txt
================================================================================
==== NodeReport ================================================================

Event: JavaScript API, location: "TriggerReport"
Filename: NodeReport.20161124.151013.8560.001.txt
Dump event time:  2016/11/24 15:10:13
Module load time: 2016/11/24 15:10:13
Process ID: 8560

Node.js version: v6.9.1
(v8: 5.1.281.83, libuv: 1.9.1, zlib: 1.2.8, ares: 1.10.1-DEV)

OS version: Linux 3.10.0-327.18.2.el7.x86_64 #1 SMP Fri Apr 8 05:09:53 EDT 2016
(glibc: 2.17)

Machine: drx-hemera x86_64

================================================================================
==== JavaScript Stack Trace ====================================================

-bash-4.2$

Looks like compile time constants are being used in src/nodereport.cc:

static void PrintVersionInformation(FILE* fp) {

  // Print Node.js and deps component versions
  fprintf(fp, "\nNode.js version: %s\n", NODE_VERSION);
  fprintf(fp, "(v8: %s, libuv: %s, zlib: %s, ares: %s)\n",
          V8::GetVersion(), uv_version_string(), ZLIB_VERSION, ARES_VERSION_STR);

zlib and ares versions are also at risk of being incorrectly reported.

Pull request incoming.

sam-github commented 7 years ago

Good catch!

sam-github commented 7 years ago

I wonder if reporting the version nodereport was built against, distinct from the run version, would be useful?

richardlau commented 7 years ago

Perhaps. The report doesn't actually include the version of nodereport itself, so maybe something like nodereport v1.0.6 built against Node.js v6.9.1?

sam-github commented 7 years ago

Sounds good to me.