Debugging “Maximum call stack size exceeded”

后端 未结 3 699
眼角桃花
眼角桃花 2020-12-29 04:33

I have a server that I can cause to die with the following output:

events.js:38
EventEmitter.prototype.emit = function(type) {
                                       


        
相关标签:
3条回答
  • 2020-12-29 04:55

    The chance of it being a "slightly-too-large chain" seems unlikely.

    It's probably a function calling the event that triggered itself.

    So if the slowing down of the code is making the infinite recursion to stop. My guess would be that you have a queue and with the slower mode its not getting filled up as fast.

    If this doesn't help then I think I need more info. Maybe someone has a catch-all for this though.

    0 讨论(0)
  • 2020-12-29 05:10

    This patch might help you find a solution. It expands the stack trace tremendously:

    https://github.com/dizzyd/node/commit/40434019540ffc17e984ff0653500a3c5db87deb

    0 讨论(0)
  • 2020-12-29 05:12

    It seems the answer is currently: sit tight and wait for Node.js to update to a newer V8 version, or build your own with the patch from this Chromium project bug report.

    This archived thread from the v8-dev mailing list shows a discussion in which

    • Dave Smith brings up this very issue and proposes a patch
    • Yang Guo of the Chromium project discusses it, files a Chromium bug against the issue, and applies a different fix
    • Dave notes that Node (0.8 at the time) is using V8 3.11 and asks about backporting the patch. Yang replies that the patch will probably land in V8 3.15 and will not be backported.

    Note that Node.js v0.8 used V8 3.11; Node.js 0.10 is currently using V8 3.14. So the patch accepted by Chromium for this issue is still "in the future" as far as Node is concerned.

    (This answer owes thanks to @Coderoshi, since it's by following the thread from his answer that I learned all this.)

    0 讨论(0)
提交回复
热议问题