We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pendingRPC 这个ConcurrentHashMap可能会有内存溢出的风险 比如client 请求异常,或者Server返回Response异常,这个pendingRPC内的对象都无法回收
public class DefaultClientHandler extends SimpleChannelInboundHandler<RPCContext>{ private ConcurrentHashMap<Long, RPCFuture> pendingRPC = new ConcurrentHashMap<Long, RPCFuture>(); @Override protected void channelRead0(ChannelHandlerContext arg0, RPCContext rpcCtx) throws Exception { RPCFuture rpcFuture = pendingRPC.get(rpcCtx.getResponse().getSeqNum()); if(rpcFuture != null){ pendingRPC.remove(rpcCtx.getResponse().getSeqNum()); rpcFuture.done(rpcCtx.getResponse()); } } public RPCFuture doRPC(RPCContext rpcCtx){ RPCFuture rpcFuture = new RPCFuture(rpcCtx, this); pendingRPC.put(rpcCtx.getRequest().getSeqNum(), rpcFuture); channel.writeAndFlush(rpcCtx); return rpcFuture; } }
The text was updated successfully, but these errors were encountered:
嗯,极端情况下会出现这个问题。超时和限流的机制还空缺。
Sorry, something went wrong.
No branches or pull requests
pendingRPC 这个ConcurrentHashMap可能会有内存溢出的风险
比如client 请求异常,或者Server返回Response异常,这个pendingRPC内的对象都无法回收
The text was updated successfully, but these errors were encountered: