Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reservedSeatTimeouts Memory Leak

See original GitHub issue

Issue Description

We encountered a suspecious memory leak when using this framework, the reservedSeatTimeouts of Room seems not release in some unkown reasons. The cpu% will grow slowly from 1 to much higher. We inspected the heap dump and found the reservedSeatTimeouts of room stored so many Timeout instances. See below screenshot: leak screenshot It seems in this function the this.reservedSeatTimeouts should delete the reservedSeatTimeout(delete this.reservedSeatTimeouts[sessionId]) when seats reservaltion expired.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

endelcommented, Dec 20, 2019

Hi guys, on version 0.11.25 I’ve pushed this change, which may fix the memory leak:

Regarding the rooms not being disposed, I do have the same issue on production for some projects, and I don’t know exactly the reason yet. It never happens locally, so it’s difficult to reproduce and find how to fix. The @colyseus/monitor often displays one room with 0 clients, and when I click on “inspect”, there is one stale client in there.

endelcommented, Oct 20, 2020

Closing as the original issue seems to have been resolved!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How does setTimeout() create a memory leak in this code?
This is technically a memory leak because there is no longer any direct reference to the setTimeout function so that you could clear...
Read more >
How can Forgotten timers or callbacks cause memory leaks in ...
When any object is tied to a timer callback, it will not be released until the timeout happens. In this scenario timer resets...
Read more >
JavaScript: setTimeout Memory Leak Prevention. - gists · GitHub
JavaScript: setTimeout Memory Leak Prevention. GitHub. Instantly share code, notes, and snippets.
Read more >
4 Types of Memory Leaks in JavaScript and How to Get Rid Of ...
In this article we will explore common types of memory leaks in client-side JavaScript code. We will also learn how to use the...
Read more >
setTimeout, closures, and IE memory leak help [Archive]
Hi: I'm trying to understand how to resolve an IE memory leak that occurs in the following general situation. Basically, if I use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found