tern icon indicating copy to clipboard operation
tern copied to clipboard

Call stack size exceeded error on file deletion

Open vincentwoo opened this issue 8 years ago • 2 comments

Hi again! Similar to the previous issue, I'm now seeing a different problem on file deletion. This one I have not isolated a reproduction case for beforehand because I am hoping the cause will be apparent to you.

A deletion request triggered the following error:

/home/coderpad/node_modules/tern/lib/infer.js:1748
if (end == null) return function(n) { return n.origin == origins; };
^

RangeError: Maximum call stack size exceeded
at /home/coderpad/node_modules/tern/lib/infer.js:1748:39
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1758:11)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1771:11)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1771:11)
at Obj.purge (/home/coderpad/node_modules/tern/lib/infer.js:1783:10)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1761:14)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1771:11)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1771:11)
at Object.AVal.purge (/home/coderpad/node_modules/tern/lib/infer.js:1771:11)
at Obj.purge (/home/coderpad/node_modules/tern/lib/infer.js:1783:10)

vincentwoo avatar May 09 '16 20:05 vincentwoo

@marijnh any thoughts on this one?

vincentwoo avatar May 14 '16 00:05 vincentwoo

Tern uses a recursive function to scan its type graph when 'purging' the types from a specific deleted file out of it. It marks AVal object with a flag to make sure it doesn't explore them twice. Could it be that your type graph is so huge or somehow 'linear' in shape (containing long chains) that exploring it recursively overflows the stack?

marijnh avatar May 14 '16 20:05 marijnh