Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

triggerReport() fails on x86 Windows #26

Closed

Description

@richardlau

Node v6.9.1 win-x86

Reproduced on Windows 7 (Visual Studio 2012 or 2015) and Windows 10 (Visual Studio 2015)

Looks like the report is truncated, exit code suggests an ACCESS_VIOLATION.

C:\work\node\github\nodereport>npm test

> nodereport@1.0.5 test C:\work\node\github\nodereport
> tap test/test*.js

test/test-api.js ...................................... 4/7
  not ok Process exited cleanly
    +++ found
    --- wanted
    -0
    +3221225477
    compare: ===
    at:
      line: 15
      column: 9
      file: test/test-api.js
      type: ChildProcess
      function: child.on
    stack: |
      ChildProcess.child.on (test/test-api.js:15:9)
    source: |
      tap.equal(code, 0, 'Process exited cleanly');

  Validating NodeReport.20161117.185734.4656.001.txt
  not ok Checking report contains JavaScript Heap section
    found: "====================================================================
============\r\n==== NodeReport ================================================
================\r\n\r\nEvent: JavaScript API, location: \"nodereport::TriggerRe
port\"\r\nFilename: NodeReport.20161117.185734.4656.001.txt\r\nDump event time:
 2016/11/17 18:57:34\r\nModule load time: 2016/11/17 18:57:34\r\nProcess ID: 465
6\r\n\r\nNode.js version: v6.9.1\r\n(v8: 5.1.281.84, libuv: 1.9.1, zlib: 1.2.8,
ares: 1.10.1-DEV)\r\n\r\nOS version: Windows 7\r\n\r\nMachine: IBM826-R93F9G4 \r
\n\r\n==========================================================================
======\r\n==== JavaScript Stack Trace ==========================================
==========\r\n\r\nJavaScript VM state: EXTERNAL\r\n\r\n 0: [pc=0x1FB353CE] C:\\w
ork\\node\\github\\nodereport\\test\\test-api.js:6:14\r\n 1: [pc=0x1FB35128] Mod
ule._compile (module.js:570:32)\r\n 2: [pc=0x1FB2FC8E] Module._extensions..js (m
odule.js:579:10)\r\n 3: [pc=0x1FB2E19A] Module.load (module.js:487:32)\r\n 4: [p
c=0x1FB2DE1A] tryModuleLoad (module.js:446:12)\r\n 5: [pc=0x1FB255D9] Module._lo
ad (module.js:438:3)\r\n 6: [pc=0x1FB25222] Module.runMain (module.js:604:10)\r\
n 7: [pc=0x1FB25118] run (bootstrap_node.js:394:7)\r\n 8: [pc=0x2AE38DB2] startu
p (bootstrap_node.js:149:9)\r\n 9: [pc=0x2AE37606] bootstrap_node.js:509:3\r\n"
    pattern: /==== JavaScript Heap/
    at:
      line: 31
      column: 11
      file: test/common.js
      function: REPORT_SECTIONS.forEach
    stack: |
      REPORT_SECTIONS.forEach (test/common.js:31:11)
      fs.readFile (test/common.js:30:23)
      FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
    source: |
      t.match(reportContents, new RegExp('==== ' + section),

  Validating NodeReport.20161117.185734.4656.001.txt
  not ok Checking report contains System Information section
    found: "====================================================================
============\r\n==== NodeReport ================================================
================\r\n\r\nEvent: JavaScript API, location: \"nodereport::TriggerRe
port\"\r\nFilename: NodeReport.20161117.185734.4656.001.txt\r\nDump event time:
 2016/11/17 18:57:34\r\nModule load time: 2016/11/17 18:57:34\r\nProcess ID: 465
6\r\n\r\nNode.js version: v6.9.1\r\n(v8: 5.1.281.84, libuv: 1.9.1, zlib: 1.2.8,
ares: 1.10.1-DEV)\r\n\r\nOS version: Windows 7\r\n\r\nMachine: IBM826-R93F9G4 \r
\n\r\n==========================================================================
======\r\n==== JavaScript Stack Trace ==========================================
==========\r\n\r\nJavaScript VM state: EXTERNAL\r\n\r\n 0: [pc=0x1FB353CE] C:\\w
ork\\node\\github\\nodereport\\test\\test-api.js:6:14\r\n 1: [pc=0x1FB35128] Mod
ule._compile (module.js:570:32)\r\n 2: [pc=0x1FB2FC8E] Module._extensions..js (m
odule.js:579:10)\r\n 3: [pc=0x1FB2E19A] Module.load (module.js:487:32)\r\n 4: [p
c=0x1FB2DE1A] tryModuleLoad (module.js:446:12)\r\n 5: [pc=0x1FB255D9] Module._lo
ad (module.js:438:3)\r\n 6: [pc=0x1FB25222] Module.runMain (module.js:604:10)\r\
n 7: [pc=0x1FB25118] run (bootstrap_node.js:394:7)\r\n 8: [pc=0x2AE38DB2] startu
p (bootstrap_node.js:149:9)\r\n 9: [pc=0x2AE37606] bootstrap_node.js:509:3\r\n"
    pattern: /==== System Information/
    at:
      line: 31
      column: 11
      file: test/common.js
      function: REPORT_SECTIONS.forEach
    stack: |
      REPORT_SECTIONS.forEach (test/common.js:31:11)
      fs.readFile (test/common.js:30:23)
      FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
    source: |
      t.match(reportContents, new RegExp('==== ' + section),

test/test-exception.js ................................ 8/8
test/test-fatal-error.js .............................. 7/7 5s
test/test-signal.js ................................... 0/1 751ms
  Skipped: 1
    Unsupported on Windows

total ............................................... 19/23


  19 passing (8s)
  1 pending
  3 failing

npm ERR! Test failed.  See above for more details.

C:\work\node\github\nodereport>

Activity

  1. richardlau commented on Nov 17, 2016

    @richardlau
    MemberAuthor

    Test passes on 64-bit Windows Node v6.9.1 on the same machines.

  2. richardlau commented on Nov 18, 2016

    @richardlau
    MemberAuthor

    Looks like it's crashing here (first fprintf, L605 of nodereport.cc):

        if (SymFromAddr(hProcess, dwAddress, &dwOffset64, pSymbol)) {
            DWORD dwOffset = 0;
            IMAGEHLP_LINE64 line;
            line.SizeOfStruct = sizeof(line);
            if (SymGetLineFromAddr64(hProcess, dwAddress, &dwOffset, &line)) {
              fprintf(fp, "%2d: [pc=0x%p] %s [+%d] in %s: line: %lu\n", i, pSymbol->Address, pSymbol->Name, dwOffset, line.FileName, line.LineNumber);
            } else {
              // SymGetLineFromAddr64() failed, just print the address and symbol
              if (dwOffset64 <= 32) { // sanity check
                fprintf(fp, "%2d: [pc=0x%p] %s [+%d]\n", i, pSymbol->Address, pSymbol->Name, dwOffset64);
              } else {
                fprintf(fp, "%2d: [pc=0x%p]\n", i, pSymbol->Address);
              }
            }
        } else { // SymFromAddr() failed, just print the address
          fprintf(fp, "%2d: [pc=0x%p]\n", i, pSymbol->Address);
        }

    Callstack:

        nodereport.node!_output_l(_iobuf * stream, const char * format, localeinfo_struct * plocinfo, char * argptr) Line 1648  C++
        nodereport.node!fprintf(_iobuf * str, const char * format, ...) Line 70 C
    >   nodereport.node!nodereport::PrintNativeStack(_iobuf * fp) Line 605  C++
        nodereport.node!nodereport::TriggerNodeReport(v8::Isolate * isolate, nodereport::DumpEvent event, const char * message, const char * location, char * name) Line 329    C++
        nodereport.node!nodereport::TriggerReport(const Nan::FunctionCallbackInfo<v8::Value> & info) Line 61    C++
        nodereport.node!Nan::imp::FunctionCallbackWrapper(const v8::FunctionCallbackInfo<v8::Value> & info) Line 174    C++
        node.exe!006fca65() Unknown
    
  3. richardlau commented on Nov 18, 2016

    @richardlau
    MemberAuthor

    So when building with vs2015 I'm seeing these warnings that I'm not seeing with vs2013 that match up with the fprintf calls:

    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
      node_report.cc
      module.cc
      win_delay_load_hook.cc
    C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file ..\src\node_report.cc) [K:\nodereport\build\nodereport.vcxproj]
    C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file ..\src\node_report.cc) [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(605): warning C4477: 'fprintf' : format string '%p' requires an argument of type 'void *', but variadic argument 2 has type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(605): warning C4313: 'fprintf': '%p' in format string conflicts with argument 2 of type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(609): warning C4477: 'fprintf' : format string '%p' requires an argument of type 'void *', but variadic argument 2 has type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(609): warning C4313: 'fprintf': '%p' in format string conflicts with argument 2 of type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(609): warning C4477: 'fprintf' : format string '%d' requires an argument of type 'int', but variadic argument 4 has type 'DWORD64' [K:\nodereport\build\nodereport.vcxproj]
      ..\src\node_report.cc(609): note: consider using '%lld' in the format string
      ..\src\node_report.cc(609): note: consider using '%I64d' in the format string
    ..\src\node_report.cc(611): warning C4477: 'fprintf' : format string '%p' requires an argument of type 'void *', but variadic argument 2 has type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(611): warning C4313: 'fprintf': '%p' in format string conflicts with argument 2 of type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(615): warning C4477: 'fprintf' : format string '%p' requires an argument of type 'void *', but variadic argument 2 has type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
    ..\src\node_report.cc(615): warning C4313: 'fprintf': '%p' in format string conflicts with argument 2 of type 'ULONG64' [K:\nodereport\build\nodereport.vcxproj]
         Creating library K:\nodereport\build\Release\nodereport.lib and object K:\nodereport\build\Release\nodereport.exp
      Generating code
    

    Looks like pSymbol->Address is 64-bits long, but %p for fprintf is 32-bits on Win32. Casting the argument to a pointer fixes this. I'll create a pull request.

  4. added 3 commits that reference this issue on Nov 18, 2016
    45f0b24
    46dfc27
    356c58a
  5. added a commit that references this issue on Dec 5, 2016
    84cb4e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions