Skip to content

"pure virtual method called" when creating a heap snapshot #28786

Description

@laino
  • Version: v11.15.0
  • Platform: Linux

Run the following script with node --inspect script.js, connect a debugger with Google Chrome and instruct it to do a heap snapshot.

Edit: See my comment below for a better snippet.

function memoryLeak() {
    return new Promise(() => {});
}

function loop() {
    for (let i = 0; i < 10000; i++) {
        memoryLeak();
    }

    setTimeout(loop, 0);
}

loop();

Roughly half of the time node will crash with "pure virtual method called".

That code actually causes a memory leak, but it will likely be annoying to debug if this isn't fixed first.

Activity

  1. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Jul 20, 2019
  2. self-assigned this
    on Jul 20, 2019
  3. laino commented on Jul 20, 2019

    @laino
    Author

    This code crashes 100% of the time instead of 50% of the time:

    function memoryLeak() {
        return new Promise(() => {});
    }
    
    async function loop() {
        for (let i = 0; i < 10000; i++) {
            memoryLeak();
        }
    }
    
    async function run() {
        while (true) {
            await loop();
        }
    }
    
    run();
  4. added
    async_hooksIssues and PRs related to the async hooks subsystem.
    promisesIssues and PRs related to ECMAScript promises.
    and removed
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Jul 20, 2019
  5. added and removed
    promisesIssues and PRs related to ECMAScript promises.
    on Jul 20, 2019
  6. addaleax commented on Jul 20, 2019

    @addaleax
    Member

    Thanks for the excellent bug report! #28789 should address this.

  7. added a commit that references this issue on Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

async_hooksIssues and PRs related to the async hooks subsystem.confirmed-bugIssues and PRs for confirmed bugs.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions