You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
I have checked the FAQ of this repository and believe that this is not a duplicate.
Steps to reproduce this issue
Run AbstractMonitorFactoryTest.testMonitorFactoryGroupCache() or DubboMonitorTest.testCount() many times(may be less than 10 is enough), you will get junit test failed.
In AbstractMonitorFactory.getMonitor(), if we call thenRunAsync() first, then call FUTURES.put(),
in MonitorListener.run, FUTRUE.get() may get null, then the junit test failed.
DubboMonitorTest.testCount()
In DubboMonitor constructor, we starter a schedule that call send() every 20 milliseconds!!
In testCount(), we collect() first, then send(), and send() every 20 milliseconds backend, but we will reset data in send() everytime, so let's consider this sequence: we call collect(), and then call send(), and before Assertions.assertEquals... , call send() backend by the schedule to reset the statisticsMap.
I describe it in Chinese again:
这个问题是偶现的, 但是可以通过多次执行testCount()来复现(执行最多10次一般就能复现出来), 原因是, 在构造Du bboMonitor 的时候, 会启动一个定时器, 每个20毫秒来执行send()方法, 且在send()设置值以后, 就会reset 全局的statisticsMap, testCount()中考虑这么一个执行顺序: 先执行collect(), 在执行send(), 然后在执行诸多的Assertions.assertEquals之前, 可能会执行每20毫秒执行一次的send(), 在这个send()方法执行完成后, statisticsMap就会被重置, 导致junit test失败
The text was updated successfully, but these errors were encountered:
Steps to reproduce this issue
Run
AbstractMonitorFactoryTest.testMonitorFactoryGroupCache()
orDubboMonitorTest.testCount()
many times(may be less than 10 is enough), you will get junit test failed.Cause Analysis
In AbstractMonitorFactory.getMonitor(), if we call
thenRunAsync()
first, then callFUTURES.put()
,in MonitorListener.run, FUTRUE.get() may get null, then the junit test failed.
send()
every 20 milliseconds!!testCount()
, wecollect()
first, thensend()
, andsend()
every 20 milliseconds backend, but we will reset data insend()
everytime, so let's consider this sequence: we callcollect()
, and then callsend()
, and before Assertions.assertEquals... , callsend()
backend by the schedule to reset the statisticsMap.I describe it in Chinese again:
这个问题是偶现的, 但是可以通过多次执行
testCount()
来复现(执行最多10次一般就能复现出来), 原因是, 在构造Du bboMonitor 的时候, 会启动一个定时器, 每个20毫秒来执行send()
方法, 且在send()
设置值以后, 就会reset 全局的statisticsMap,testCount()
中考虑这么一个执行顺序: 先执行collect()
, 在执行send()
, 然后在执行诸多的Assertions.assertEquals之前, 可能会执行每20毫秒执行一次的send()
, 在这个send()
方法执行完成后, statisticsMap就会被重置, 导致junit test失败The text was updated successfully, but these errors were encountered: