-
Notifications
You must be signed in to change notification settings - Fork 9k
HADOOP-19386. Avoid adding asynchronous calls indefinitely which can cause Out-of-Memory. #7254
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
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@Hexiaoqiao @KeeProMise Sir, please help review this PR when you have free time, Thanks a lot. |
Hi, @hfutatzhanghb, thanks for your contribution. Functionally, I don't see any issues; however, in terms of implementation, I think we could manage an attribute called asyncCallCounter within each connect instance to control the maximum number of calls for that connect. This approach would eliminate the need for the asyncCallCounters map, where each remoteId corresponds to a connect object. Moreover, the connect object can be removed, but the asyncCallCounters map can only add data and cannot delete it. I also think asyncCallCounter field is useless if this PR applied. |
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.
This PR should be prefixed with "hadoop-XXXX".
final Call call = calls.remove(callId); | ||
releaseAsyncCallPermit(); |
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.
I think we can add a removeCall method in the connect class, and modify the existing addCall method to include a checkAsyncCall function.
/**
* Add a call to this connection's call queue and notify
* a listener; synchronized.
* Returns false if called during shutdown.
* @param call to add
* @return true if the call was added.
*/
private synchronized boolean addCall(Call call) {
if (shouldCloseConnection.get())
return false;
checkAsyncCall();
calls.put(call.id, call);
notify();
return true;
}
private void removeCall(int callId) {
final Call call = calls.remove(callId);
releaseAsyncCallPermit();
}
74eddcb
to
f5b5cbd
Compare
@KeeProMise Thanks sir, have fixed. |
refer to #7287 |
💔 -1 overall
This message was automatically generated. |
Description of PR
Avoid adding calls indefinitely make Router Out-of-Memory.