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(filter): Fixed multiple connections closing in Moira-Filter caused by PR-562. #570

Conversation

r9odt
Copy link
Contributor

@r9odt r9odt commented Aug 4, 2020

Fixed multiple connections closing in Moira Filter when closing one of the tcp connection.

PR Summary

A go-routine leak was fixed in PR-562, but it caused closing multiple connections when any of them were close. I guess that this is because a channel named handler.terminate is common to all goroutines, spawned in any instance of the handle function. When any data send to this channel, several goroutines receive them and closing their connection.

This PR suggests using an extra computation using the channel, named closeConnection to handle goroutine completion instead simple send any data into handler.terminate. This channel is local to each call to the handle function and the goroutine it spawns. Thus, when one connection will be closed, the goroutine, associated with the specific call to the handle function will complete and others continue work. Watching for closeConnection channel implemented via select block.

Additional information

Closes/Relates #issue

…d by PR-562.

Fixed multiple connections closing in Moira Filter when closing one of the tcp connection.
@r9odt r9odt requested a review from a team as a code owner August 4, 2020 15:20
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 80.919% when pulling a1ee597 on JIexa24:fix/fix_multiple_connection_closing_in_PR-562 into c2efd5d on moira-alert:master.

@litleleprikon litleleprikon merged commit bfafcf0 into moira-alert:master Aug 5, 2020
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