Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence list keep growing when using Presence.update #175

Closed
arjan opened this issue Jun 14, 2023 · 3 comments · Fixed by #176
Closed

Presence list keep growing when using Presence.update #175

arjan opened this issue Jun 14, 2023 · 3 comments · Fixed by #176

Comments

@arjan
Copy link

arjan commented Jun 14, 2023

It seems #172 (released in 2.1.2) seems to have introduced a bug where the list of presences keeps growing when a process uses Presence.update.

How to reproduce

The following gist is a test script that starts a PubSub server and a Phoenix presence tracker.

https://gist.github.com/arjan/6702b4b9fd6b97e9b1a355313ed1620b

Periodically, genserver processes are started that do Presence.track and, a bit later, Presence.update, and another bit later stop again.

A poller process runs that shows the number of running (local) processes, the number of items in the presence list, and the number of items in the presence list split out by node.

Run the test script in 2 terminals with:

▶ elixir --name a@127.0.0.1 --cookie hello ./presence_bug.exs
▶ elixir --name b@127.0.0.1 --cookie hello ./presence_bug.exs

When running on 2.1.1, the presence count is stable, settling at about ~100 processes per node.

10:30:43.465 [warning] Local processes: 106 - Presence count: 178 - Per node counts: ["a@127.0.0.1": 106, "b@127.0.0.1": 110]

When running on 2.1.2, the presence count keeps increasing, because the presences for the non-local nodes are not cleaned up, the per-node counts for the non-local node keeps increasing, eg:

10:29:55.630 [warning] Local processes: 100 - Presence count: 355 - Per node counts: ["a@127.0.0.1": 322, "b@127.0.0.1": 100]
@MattiasOlla
Copy link

Thanks for reporting, we also had issues with this. It also led to our application consuming more than twice as much more memory as before updating:

image

@jonatanklosko
Copy link
Contributor

@arjan thanks for the great reproduction! I'm looking into this.

@chrismccord
Copy link
Member

Fixed in 2.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants