<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.2-SNAPSHOT</li>
<li>Operating System version: WIN7</li>
<li>Java version: java8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>run dubbo service， serviceimplement code sleep for 4s.</li>
<li>run dubbo client ,set timeout=2s and async = true.</li>
<li>use dubbo client to invoke service for times and watch the ActiveLimitFilter class.<br>
onError(Throwable t, Invoker&lt;?&gt; invoker, Invocation invocation) could not be reach.</li>
<li>all request will generate RPCException("Waiting concurrent invoke timeout</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？<br>
the client aync invoke timeout Exception should trigger the onError() method and clear invoke .</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">onError() can not be reach</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Caused by: org.apache.dubbo.rpc.RpcException: Waiting concurrent invoke timeout in client-side for service:  com.ctrip.framework.cdubbo.demo3.api.HelloBOMService, method: get, elapsed: 2000, timeout: 2000. concurrent invokes: 4. max concurrent invoke limit: 4
	at org.apache.dubbo.rpc.filter.ActiveLimitFilter.invoke(ActiveLimitFilter.java:75)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:58)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invokeAsync(CDubboInvoker.java:186)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invoke(CDubboInvoker.java:74)
	at com.ctrip.framework.cdubbo.internal.filter.CDubboInvokerFilter.invoke(CDubboInvokerFilter.java:32)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150)
	at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
	at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82)"><pre class="notranslate"><code class="notranslate">Caused by: org.apache.dubbo.rpc.RpcException: Waiting concurrent invoke timeout in client-side for service:  com.ctrip.framework.cdubbo.demo3.api.HelloBOMService, method: get, elapsed: 2000, timeout: 2000. concurrent invokes: 4. max concurrent invoke limit: 4
	at org.apache.dubbo.rpc.filter.ActiveLimitFilter.invoke(ActiveLimitFilter.java:75)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:58)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invokeAsync(CDubboInvoker.java:186)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invoke(CDubboInvoker.java:74)
	at com.ctrip.framework.cdubbo.internal.filter.CDubboInvokerFilter.invoke(CDubboInvokerFilter.java:32)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:82)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$CallbackRegistrationInvoker.invoke(ProtocolFilterWrapper.java:150)
	at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
	at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:82)
</code></pre></div>
<p dir="auto">some error will be occured in all consumerFilter which add logic in OnError method.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.8</li>
<li>Operating System version: linux</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>dubbo线程数设置500或者更多</li>
<li>每次请求的数据量尽量大，我们的环境是10M左右</li>
</ol>
<p dir="auto">运行一段时间后就会内存溢出，我们的环境上10分钟左右就会溢出。<br>
监控内存占用情况如下：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15316931/97517225-c345fa80-19cf-11eb-9578-3ebecbe041a7.png"><img width="1148" alt="WechatIMG391" src="https://user-images.githubusercontent.com/15316931/97517225-c345fa80-19cf-11eb-9578-3ebecbe041a7.png" style="max-width: 100%;"></a></p>
<p dir="auto">排查发现，是org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectInput这个类里面有线程局部变量，会持有序列化过程中的数据，不会释放。导致内存溢出。</p>
<p dir="auto">下面是修改方法，已在测试环境验证<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15316931/97517784-d5746880-19d0-11eb-9e76-f572d23354ce.png"><img width="1440" alt="WechatIMG393" src="https://user-images.githubusercontent.com/15316931/97517784-d5746880-19d0-11eb-9e76-f572d23354ce.png" style="max-width: 100%;"></a><br>
：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15316931/97517809-e3c28480-19d0-11eb-9fa4-a1c12e30857a.png"><img width="1064" alt="WechatIMG394" src="https://user-images.githubusercontent.com/15316931/97517809-e3c28480-19d0-11eb-9fa4-a1c12e30857a.png" style="max-width: 100%;"></a></p>