sofastack / sofa-jraft

A production-grade java implementation of RAFT consensus algorithm.
https://www.sofastack.tech/projects/sofa-jraft/
Apache License 2.0
3.57k stars 1.14k forks source link

ut failed #301

Closed JerryYangSH closed 4 years ago

JerryYangSH commented 4 years ago

Describe the bug

Run tests under jraft-core, partial (24) tests failed. $mvn install -pl jraft-core

Results :

Failed tests: testShuttingDownLeaderTriggerTimeoutNow(com.alipay.sofa.jraft.core.NodeTest) testShuttingDownLeaderTriggerTimeoutNow(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testLeaderTransferBeforeLogIsCompleted(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testLeaderTransferBeforeLogIsCompleted(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testFollowerStartStopFollowing(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testFollowerStartStopFollowing(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testTripleNodes(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testTripleNodes(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testInstallSnapshotWithThrottle(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testInstallSnapshotWithThrottle(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testRemoveFollower(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testRemoveFollower(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testInstallLargeSnapshot(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testInstallLargeSnapshot(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testLeaderShouldNotChange(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testLeaderShouldNotChange(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testChangePeers(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testChangePeers(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testChangePeersAddMultiNodes(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testChangePeersAddMultiNodes(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testSetPeer1(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testSetPeer1(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2> testSetPeer2(com.alipay.sofa.jraft.core.NodeTest): expected:<2> but was:<0> testSetPeer2(com.alipay.sofa.jraft.core.NodeTest): expected:<0> but was:<2>

Tests run: 368, Failures: 24, Errors: 0, Skipped: 0

Expected behavior

Expected all UT passed

Actual behavior

24 of 368 failed

Steps to reproduce

Run in Linux: mvn install -pl jraft-core

Minimal yet complete reproducer code (or GitHub URL to code)

jerry@u19:/tmp/sofa-jraft$ git status On branch master Your branch is up to date with 'origin/master'.

jerry@u19:/tmp/sofa-jraft$ git log commit a503b5b2f75359505d0c4a3bcc5d0e68495d58bf (HEAD -> master, origin/master, origin/HEAD) Author: block jiachun_fjc@163.com Date: Tue Oct 15 22:35:58 2019 +0800

Environment

jerry@u19:/tmp/sofa-jraft$ uname -a Linux u19 5.0.0-31-generic #33-Ubuntu SMP Mon Sep 30 18:51:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

jerry@u19:/tmp/sofa-jraft$ mvn --version Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Apache Maven 3.6.0 Maven home: /usr/share/maven Java version: 12.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-12-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.0.0-31-generic", arch: "amd64", family: "unix"

fengjiachun commented 4 years ago

单独跑 NodeTest 试试

mvn --projects jraft-core test -Dtest=com.alipay.sofa.jraft.util. NodeTest#test*

weichengzhili commented 4 years ago

这个问题 和平台 os 有关 我用ubuntu 16.04 跑 UT 没有问题

sofa-core-ut-test.zip

JerryYangSH commented 4 years ago

单独跑 NodeTest 试试

mvn --projects jraft-core test -Dtest=com.alipay.sofa.jraft.util. NodeTest#test*

Still failed。

fengjiachun commented 4 years ago

@JerryYangSH Can you give more information? Which test case (method)?

JerryYangSH commented 4 years ago

@JerryYangSH Can you give more information? Which test case (method)?

It succeeds now after I cleaned /tmp and reboot the OS. It looks like something related to earlier unclean killed test process. I used the command "~/opensources/sofa-jraft$ mvn --projects jraft-core test -Dtest=com.alipay.sofa.jraft.core.NodeTest" . Thanks for your instant reply!