zrlw edited a comment on issue #8689: URL: https://github.com/apache/dubbo/issues/8689#issuecomment-917424836
翻看一下github构建日志,有一个值得注意的地方是ubuntu构建日志很少出现超时,大部分都是40分钟左右就完成了,但是windows2019构建日志出现的超时越来越频繁,虽然超时和UT代码自身缺陷、AfterEach释放全局资源与dubbo资源生命周期管理不匹配有关,但是为什么ubuntu执行就很少出问题呢? 更新:从构建日志看,ubuntu和windows2019测试类的执行顺序差别很大,ubuntu执行mvn测试dubbo-config-api时依次是MetadataServiceExporterTest、ServiceConfigTest、ProtocolConfigTest等等,而windows执行顺序依次是AbstractConfigTest、AbstractMethodConfigTest、AbstractReferenceConfigTest等等(好像是字典序)。 **Default ordering used by this Maven plugin is filesystem, which means unit tests will execute in the order they are presented in the file system. Problem is that NTFS and Linux file systems do not provide same ordering - NTFS provides alphabetical ordering of files.** **unit tests should be independent of each other.The solution is to execute the tests in random order so that any dependencies between tests are found and can be removed.** dubbo的UT存在依赖关系这个是导致构建出现问题的根源,latch.await挂住只是表象,加超时只能解决hang不能解决构建失败。 建议在pom增加runOrder配置,设为random,以尽快确定哪些测试类存在依赖关系,将存在依赖的相关测试类进行合并处理,这样做可能比加超时机制要好一些。 ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <runOrder>random</runOrder> </configuration> </plugin> ``` PS: 基本可以确定导致windows2019 github hang住的代码是countdownlatch.await(),严格来说单元测试代码里不应该出现无限等待的代码,await要带上超时时间,以避免万一出了问题把构建job直接hang掉。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org