ember-cli-fastboot icon indicating copy to clipboard operation
ember-cli-fastboot copied to clipboard

fix: properly attribute stack with fileName, removes slow leak

Open gabrielcsapo opened this issue 3 years ago • 1 comments

Co-authored-by: Brenden Palmer [email protected]

:::DO NOT USE:::

SEEMS LIKE SOURCE MAPS AND VM IS NOT WORKING PROPERLY

Summary

We found a slow leak in fastboot, upon further analysis of the heap we found that the https://github.com/evanw/node-source-map-support in https://github.com/evanw/node-source-map-support/blob/ac2c3e4c633c66931981ac94b44e6963addbe3f4/source-map-support.js#L37-L41 will increase over time by design as errors are created. If we utilize the built in source-map option in node we get better results and node will handle this weak map internally.

Screen Shot 2022-06-09 at 10 52 11 AM

Before

stack with incorrect path on disk

Screen Shot 2022-06-09 at 10 41 42 AM

Screen Shot 2022-06-09 at 10 42 43 AM

After

stack with correct path on disk

Screen Shot 2022-06-09 at 10 42 00 AM Screen Shot 2022-06-09 at 10 42 09 AM Screen Shot 2022-06-09 at 10 42 11 AM

gabrielcsapo avatar Jun 09 '22 17:06 gabrielcsapo

I was chatting with @brendenpalmer and @gabrielcsapo and I think we might be able to do some sort of fall back logic like:

  1. detect if node >= 14 -- if so -> just call process.setSourcEMapsEnabled(true)
  2. if node ~ 12 -> check if CLI flag or NODE_OPTIONS is setup
  3. else -> do the old brokenish thing

This would both fix the bug for folks using more modern Node (14+) and continue working (with existing behavior) for folks on Node 12 without the CLI flag on or Node versions older than 12 all without being breaking (as far as I can tell).

rwjblue avatar Jun 09 '22 21:06 rwjblue