We've got a Vue.js (v2.2.6) app running in production with server-side rendering based on the Hacker News demo app structure. We've got a memory leak that causes the process to run out of memory and crash after around 6-12 hours, and we've started taking heap snapshots on the server to try and track the issue.
However, we've been digging through these for days and haven't really gotten anywhere. The thing that sticks out (as you can see in the below screenshot) is that there are many instances of VueComponent
and Vue$2
being created and never deleted from memory. I don't know enough about the internals of Vue's server-side rendering to know if this is a real lead and where to look from there if it is.
Has anyone run into something like this or have any ideas where we might look to determine what could be causing this?
We've got a Vue.js (v2.2.6) app running in production with server-side rendering based on the Hacker News demo app structure. We've got a memory leak that causes the process to run out of memory and crash after around 6-12 hours, and we've started taking heap snapshots on the server to try and track the issue.
However, we've been digging through these for days and haven't really gotten anywhere. The thing that sticks out (as you can see in the below screenshot) is that there are many instances of VueComponent
and Vue$2
being created and never deleted from memory. I don't know enough about the internals of Vue's server-side rendering to know if this is a real lead and where to look from there if it is.
Has anyone run into something like this or have any ideas where we might look to determine what could be causing this?
Share asked Mar 31, 2017 at 14:32 James SimpsonJames Simpson 13.7k26 gold badges85 silver badges111 bronze badges 2- Maybe github./vuejs/vue/issues/5089 ? – Roy J Commented Mar 31, 2017 at 15:01
- I saw that, but we don't have any global mixins. – James Simpson Commented Mar 31, 2017 at 15:19
1 Answer
Reset to default 7I finally tracked this down by switching to a more powerful debugging tool than using heap snapshots alone: LLDB and the llnode plugin. This should be very familiar if you have used Joyent's SmartOS and mdb, and it gives you a lot more data to drill into than the standard heap snapshot.
I used the dumpme node module to trigger a core dump inside my production application (there are other ways of doing this, but I found this easiest).
I then followed the instructions found at https://developer.ibm./node/2016/09/27/advances-in-core-dump-debugging-for-node-js/ and started tracing the references to the VueComponents that were being held in memory.
> lldb node -c core
(lldb) plugin load ./node_modules/llnode/llnode.so
(lldb) v8 findjsobjects
(lldb) v8 findjsinstances VueComponent
(lldb) v8 inspect ...
In this case, it turned out that there was a recursive setTimeout that was never getting cleared when the ponent was destroyed, so the reference to the entire application stayed in memory.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745072676a4609647.html
评论列表(0条)