From ab5b9793e80c7235707eb33c67c92d55d8d18cca Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 25 Feb 2020 16:53:27 -0500 Subject: add a faulty leader example --- scripts/faulty_leader_demo.sh | 24 ++++++++++++++++++++++++ scripts/run_demo_client.sh | 9 +++++---- 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100755 scripts/faulty_leader_demo.sh (limited to 'scripts') diff --git a/scripts/faulty_leader_demo.sh b/scripts/faulty_leader_demo.sh new file mode 100755 index 0000000..a4df108 --- /dev/null +++ b/scripts/faulty_leader_demo.sh @@ -0,0 +1,24 @@ +#!/bin/bash +killall hotstuff-app +./examples/hotstuff-app --conf ./hotstuff-sec0.conf > log0 2>&1 & +leader_pid="$!" +rep=({1..3}) +if [[ $# -gt 0 ]]; then + rep=($@) +fi +for i in "${rep[@]}"; do + echo "starting replica $i" + #valgrind --leak-check=full ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 & + #gdb -ex r -ex bt -ex q --args ./examples/hotstuff-app --conf hotstuff-sec${i}.conf > log${i} 2>&1 & + ./examples/hotstuff-app --conf ./hotstuff-sec${i}.conf > log${i} 2>&1 & +done +echo "All replicas started. Let's issue some commands to be replicated (in 5 sec)..." +sleep 5 +echo "Start issuing commands and the leader will be killed in 5 seconds" +./examples/hotstuff-client --idx 0 --iter -1 --max-async 4 & +cli_pid=$! +sleep 5 +kill "$leader_pid" +echo "Leader is dead. Let's try to restart our clients (because the simple clients don't timeout/retry some lost requests)." +kill "$cli_pid" +./examples/hotstuff-client --idx 0 --iter -1 --max-async 4 diff --git a/scripts/run_demo_client.sh b/scripts/run_demo_client.sh index c124d5d..09fafeb 100755 --- a/scripts/run_demo_client.sh +++ b/scripts/run_demo_client.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Try to run run_demo.sh first and then this script, then use Ctrl-C to -# terminate the proposing replica (e.g. replica 0). Leader rotation will be -# scheduled. Try to kill and run this script again, new commands should still -# get through (be replicated) once the new leader becomes stable. +# Try to run the replicas as in run_demo.sh first and then run_demo_client.sh. +# Use Ctrl-C to terminate the proposing replica (e.g. replica 0). Leader +# rotation will be scheduled. Try to kill and run run_demo_client.sh again, new +# commands should still get through (be replicated) once the new leader becomes +# stable. ./examples/hotstuff-client --idx 0 --iter -1 --max-async 4 -- cgit v1.2.3-70-g09d2