Skip to content

node --prof-process is broken #19044

Description

@mourner
  • Version: v9.6.1
  • Platform: macOS

node --prof-process doesn't work in the current Node version.

→ node -v
v9.6.1
→ node --prof-process
evalmachine.<anonymous>:31
module.exports = { versionCheck };
^

ReferenceError: module is not defined
    at evalmachine.<anonymous>:31:1
    at internal/v8_prof_processor.js:41:28
    at NativeModule.compile (bootstrap_node.js:653:7)
    at Function.NativeModule.require (bootstrap_node.js:598:18)
    at startup (bootstrap_node.js:139:20)
    at bootstrap_node.js:665:3

Same result when pointing to an isolate file.

Activity

  1. addaleax commented on Feb 27, 2018

    @addaleax
    Member

    You’re right, python tools/test.py tick-processor is also failing for me on master.

    I think this might be coming from 99d693d, /cc @MylesBorins

    Do you think you could try this fix?

    --- a/lib/internal/v8_prof_processor.js
    +++ b/lib/internal/v8_prof_processor.js
    @@ -34,9 +34,9 @@ if (process.platform === 'darwin') {
       tickArguments.push('--windows');
     }
     tickArguments.push.apply(tickArguments, process.argv.slice(1));
    -script = `(function(require) {
    +script = `(function(module, require) {
       arguments = ${JSON.stringify(tickArguments)};
       function write (s) { process.stdout.write(s) }
       ${script}
     })`;
    -vm.runInThisContext(script)(require);
    +vm.runInThisContext(script)(module, require);
  2. fhinkel commented on Feb 28, 2018

    @fhinkel
    Contributor

    🤔 I thought we had just fixed --prof-process. Does it work on master?

  3. fhinkel commented on Feb 28, 2018

    @fhinkel
    Contributor

    #18451, @cjihrig fixed it.

  4. mourner commented on Feb 28, 2018

    @mourner
    Author

    @fhinkel as far as I can see, it was broken again a week later — it's a different issue. I guess some new tests for flag would help :)

  5. added a commit that references this issue on Feb 28, 2018
  6. addaleax commented on Feb 28, 2018

    @addaleax
    Member

    Does it work on master?

    When we were testing for #18623, it didn’t work on master to begin with. :/

    I guess some new tests for flag would help :)

    We do have tests, but they’re resource-consuming and aren’t run as part of the standard test suite – I guess they just weren’t run the last time when changes to this were landed.

    @mourner I’ve opened #19059 with the above patch, could you try to check that out?

  7. mourner commented on Feb 28, 2018

    @mourner
    Author

    @addaleax thanks a lot for the fix! I don't have Node source code set up locally but can try checking if no one else beats me to it in the nearest days.

  8. aabuelenin commented on Mar 5, 2018

    @aabuelenin

    @addaleax thanks for the solution, it does work in the sense that I stopped getting the error, but --prof-process won't produce any output, it just keeps running without giving any feedback. I ran it against a 4MB isolation file and left it for an hour. Guess we need a profiler to profile node profiler :)

  9. mourner commented on Mar 5, 2018

    @mourner
    Author

    @addaleax thanks a lot for the merge! Given the comment above by @aabuelenin, can we reopen the ticket until --prof-process is confirmed to work?

  10. reopened this on Mar 5, 2018
  11. mourner commented on Mar 11, 2018

    @mourner
    Author

    Hey, any updates on this? Did anyone get --prof-process to work with Node v9?

  12. 12 remaining items

  13. addaleax commented on Sep 12, 2018

    @addaleax
    Member

    @joseph-jja Can you open a new issue, please? I get that the bottom line is the same, but it would really be nice to not piggy-back on existing issues. That also gives the problem you are experiencing more visibility.

  14. mourner commented on Sep 12, 2018

    @mourner
    Author

    As far as I'm concerned, the original issue is resolved — --node-prof works as expected in Node v10.10. So let's close this and create new issues for any related problems.

  15. joseph-jja commented on Sep 12, 2018

    @joseph-jja

    So does this mean prof process won't be fixed in node 8.x?

  16. MylesBorins commented on Sep 12, 2018

    @MylesBorins
    Contributor

    @joseph-jja we are interested in fixing it. Can you please open a new issue explaining how to reproduce the error on 8.x

  17. hubiierik commented on Nov 28, 2018

    @hubiierik
  18. MylesBorins commented on Nov 28, 2018

    @MylesBorins
    Contributor

    I just attempted to run the below on v8.14.0 and it worked fine. Am I missing something

    node --pro -e "for(var i=0;i<1E7;i++);"
    node --prof-process isolate*.log
    
  19. joseph-jja commented on Nov 28, 2018

    @joseph-jja

    v8.14.0 generates isolate logs and when I prof process doing the below:

    node --prof-process isolatexxxxx.log > logs/prof-1.txt

    it spits out a bunch of errors to the console. What does make it into the file does look like it did some profiling.

  20. joseph-jja commented on Nov 28, 2018

    @joseph-jja

    v8.14.0 also generates messages about Code move event for unknown code: with an address which do not end up in the isolate logs, which used to. Not sure they belong there. Also for each profile log it spits out this message:

    (node:15644) [BROKEN_PROFILE_FILE] Warning: Profile file isolate-0x103000000-v8.log is broken
    "tick,0x7fff91dedf49,117042369,1,0x10003965a,3,0x1001f27b0,0x24708cf3be16,0x24708cf3b8cd,0x24704dad98b7,0x2" at the file end is broken

    (node:15735) [BROKEN_PROFILE_FILE] Warning: Profile file isolate-0x103800000-v8.log is broken
    "tick,0x10062eaa7,117041854,0,0x7fff" at the file end is broken

    I suppose somewhere after the tick there is a tock?

  21. mmarchini commented on Nov 29, 2018

    @mmarchini
    Contributor

    @joseph-jja I believe the issue you might be looking for is #19199.

    By the way, I tried --prof and --prof-process on several v8.x versions (including the ones where issues were reported) and didn't get any errors. We need reproducibles, if you could share a minimal example (with code) where this issue is happening it would be awesome :)

  22. MylesBorins commented on Nov 29, 2018

    @MylesBorins
    Contributor

    I'm going to reopen this issue until we have a fix for 8.x

  23. BridgeAR commented on Jan 2, 2020

    @BridgeAR
    Member

    Node.js v8.x has reached the end-of-life and won't receive any fixes anymore. I am closing this since this issue only applies to Node.js v8.x. No matter if you run into this issue or not, please update to a newer Node.js version in case you still use v8.x.

  24. added a commit that references this issue on Jul 27, 2026
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