sails: Memory leak even with homepage request!
I create a new sails project, add some lines into the default homepage view:
<script>
setTimeout(function(window.location.reload();), 2000);
</script>
I make the page auto reload every 2 seconds, and this causes my VPS memory usage keep increasing until the VPS crash because out of memory. I can’t event ssh into the VPS and have to restart on cpanel.
Is this normal? If not, how can I fix this? Thanks
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 52 (20 by maintainers)
To be clear, we still investigate every claim to the best of our ability-- but the community around Sails has grown to the point now that lately we find ourselves investigating potential memory leaks at least once per month, if not more often. And as @particlebanana pointed out, despite spending many hours diving in on numerous occasions, we just haven’t been able to replicate a leak (other than the Node v0.12-specific issue mentioned above). As you can imagine, it’s gotten to the point where it’s like the boy who cried wolf-- which isn’t good for anyone.
There are definitely situations where memory leaks can occur in Sails apps (happened to me more than I’d care to talk about)-- it’s just been my experience up until this point that those leaks come from either using non-production settings or from issues in app level code.
Something to keep in mind is that @particlebanana and I are running a couple of active apps on the latest stable version of Sails ourselves; thus we’re very aware of production issues in the latest stable version of Sails (i.e. if they arise, they hit us very close to home). If a memory leak was found in Sails or Waterline core w/ recommended production settings, we’d expect to find out about it pretty quickly. But since we can’t be 100% certain (because other adapters could be in play, Node version differences, etc) we have to check into this kind of thing every time.
So here’s what I’d ask from everyone going forward:
Before reporting a potential memory leak
.catch()).Really appreciate the help! 🙇