-
Notifications
You must be signed in to change notification settings - Fork 356
memory leak #201
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
memory leak #201
Conversation
I think this is a work around the memory leak, it should be ok to infinitely try to connect on an invalid ip address. |
Probably a slightly better way is to check for factory availability. If it isn't |
if (++errors < 5) { | ||
activeFactories.add(factory); | ||
} else { | ||
logger.warn("Exception count greater than 5, not re-adding factory {}", factory.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: greater than 4?
@NiteshKant the loadbalancer (most of the time) won't select the factory if the availability is 0, it will only do it if there are no other available factories. The bug is that there's a period (while we're connecting to a host), when the factory is not in I agree that this is a bug, but disagree that it is the cause of the memory leak. |
@stevegury thanks for the explanation of the bug! I was just wondering whether that is a better condition than checking for 5 magical error number :) Anyway, if this change looks good to you, please approve! |
@NiteshKant I think we should merge this, and add an issue to address this properly. |
@robertroeser Agreed. |
I think the work around is acceptable for now. |
Problem
There is a race conditon that causes a SocketAdder to not be removed from the of available sockets if it is removed from the list of available servers. This has the side-effect of creating a memory leak because it will continually try to connect, but fail.
Modifications
After a SocketAdder errors out five times it will no long add itself to the list of active factories.
Result
No more memory leak, and after 5 errors the SocketAdder is removed from the list.