Skip to content

Conversation

@janl
Copy link
Member

@janl janl commented Nov 26, 2021

No description provided.

Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent memory leaks, a better pattern might be to not unlink and respawn mem3_cluster processes, but to keep the existing (single) one around. We are already linked to it and we don't set the trap_exit flag. So if it crashes it should restart the couch_peruser gen_server as well.

-spec init_state() -> #state{}.
init_state() ->
reset_state(#state{mem3_cluster_pid = Pid} = State) when is_pid(Pid) ->
unlink(Pid),
Copy link
Contributor

@nickva nickva Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we just unlink the process, but the process would still be alive and we'd be accumulating them and each one would still be sending stable|unstable events. The memleak is not from the links themselves but from the number of processes spawned.

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 this pull request may close these issues.

3 participants