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

fix memleak in couch_peruser, patch by @rnewson #3851

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open

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.

None yet

3 participants