Skip to content

Duplicated stack trace #20010

Description

@advanceddeveloper
  • Version: 9.11.1
  • Platform: windo 10
  • Subsystem: stack trace?

Hello. Im working on a project and experiencing weird bug. Our stack trace is duplicated, I mean it displays two times functions that I called only once. My project is very big, so we did our best to reduce it as much as we could. Here is minimal repro

"use strict";

var util = require("util");

var v1 = "example";
var v2 = [];
var v3 = null;

var closure = getClosure(v3);
var value = closure("func")(v1);
console.log(v2.length);

function getClosure(v1) {
  if(v1 === "example")
    return v1;

  try {
    v1 = `${v1.length}`;
  } catch(v2) {
    v1 = util.inspect(v2);
    v3 = v2;
  }

  var f = v2 => {
    if(v2 === "func") return f.func(v2);
    return f.obj[v1];
  };
  f.func = a => f(a && v3);
  f.obj =  {
    [v1](v2) {
      return v2.obj.length;
    }
  };

  return f;
}

It reproduces 100% of times. we tried to remove some parts of the code, but then it dont rreproduces issue.
I know this code throws error, this is because of obj is not a defined property, so it is undefined and therefore cannot read length of property obj, but it is not reason to print duplicated stack trace

My apologies for bad formatting, not very familiar with github markdown

Activity

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

    questionIssues asking questions about Node.js.wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions