<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.7</li>
<li>Operating System version: Windows、Linux</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">In serviceconfig, if the delay exposure service has an exception similar to the port occupied, it will be swallowed up by the thread pool</p>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">Exception can be thrown out or recorded</p>
<h3 dir="auto">Code</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private static final ScheduledExecutorService DELAY_EXPORT_EXECUTOR = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(&quot;DubboServiceDelayExporter&quot;, true));"><pre class="notranslate"><code class="notranslate">private static final ScheduledExecutorService DELAY_EXPORT_EXECUTOR = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("DubboServiceDelayExporter", true));
</code></pre></div>
<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.6.5</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框架的Java程序长时间不发布会出现内存使用不足的情况，通过线上dump文件发现InternalThreadLocal对象很多ReferenceQueue为null,但是对象空间还存在。具体JProfile分析截图如下<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/33508425/68990122-4b4bf680-088a-11ea-8d13-fa48e718779d.png"><img src="https://user-images.githubusercontent.com/33508425/68990122-4b4bf680-088a-11ea-8d13-fa48e718779d.png" alt="image" style="max-width: 100%;"></a></li>
<li>然后查看2.6.5的Dubbo源码发现，发现ConsumerContextFilter类中，并没有调用removeContext和removeServerContext方法，以及ContextFilter类中仅仅只调用了removeContext方法并没有调用removeServerContext。</li>
<li>但是我看dubbo 的2.7.0的版本开始这2个类的实现都调用removeContext和removeServerContext方法，那是不是说明2.6.5的版本由于没有调用removeContext和removeServerContext方法，从而会导致内存泄漏以及线程对象可能会错乱的情况呢？</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>
ConsumerContextFilter和ContextFilter在2.6.5版本应该要调用removeContext和removeServerContext方法来清楚当前线程赋值的对象。另外如果不升级dubbo版本如何去解决内存的问题呢？</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?<br>
Java持续不重启，运行时间过长，会出现内存一直在上升的情况。<br>
If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>