Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Replicator: don't keep the conn object forever #263

Merged
merged 3 commits into from
Aug 17, 2017
Merged

Replicator: don't keep the conn object forever #263

merged 3 commits into from
Aug 17, 2017

Conversation

datoug
Copy link
Contributor

@datoug datoug commented Jul 31, 2017

remoteReplicatorConn(similar for storehostConn) is a map we use to do dedups against incoming requests. For example, if there's already a connection for ext1, then we receive a new request for the same extent, we close the existing connection for ext1, remove the connection from the map, then creates a new connection and store the new connection in the map.
The problem is if there's no duplicate connection(as in the common case), we never delete the connection from the map, which causes memory leak

In fact the dedup in replicator is not needed, as we're already doing dedup in store host side. But the map is still useful for the admin API, so I repurposed the map to only be used by the admin API, and the connection will be deleted from the map at the end of the API call(as soon as the connection is closed)

@datoug datoug requested review from thuningxu and kirg July 31, 2017 21:49
@coveralls
Copy link

coveralls commented Jul 31, 2017

Coverage Status

Coverage increased (+0.4%) to 68.38% when pulling 9607068 on fix_FD into 8c9381a on master.

@datoug datoug changed the title Fix replicator FD leak Replicator: don't keep the conn object forever Aug 17, 2017
@datoug datoug merged commit 39ddbc0 into master Aug 17, 2017
@datoug datoug deleted the fix_FD branch August 17, 2017 21:02
datoug added a commit that referenced this pull request Aug 30, 2017
Replicator: don't keep the conn object forever
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants