Skip to content

Commit

Permalink
tests: Forcefully kill the daemon when the tests are done
Browse files Browse the repository at this point in the history
The elecrtum RPC thread can in some circumstances deadlock when shutting
down. This let the tests pass even if the daemon doesn't shutdown cleanly.

An actual proper fix will be implemented soon, tracked here:
#66
  • Loading branch information
shesek committed Nov 11, 2020
1 parent c0d7476 commit b9efef2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ runbwt () {
cleanup() {
trap - SIGTERM SIGINT
set +eo pipefail
kill `jobs -rp` 2> /dev/null
kill -9 `jobs -rp` 2> /dev/null
wait `jobs -rp` 2> /dev/null
ele daemon stop &> /dev/null
[ -n "$KEEP_DIR" ] || rm -rf $DIR
kill -- -$$ 2> /dev/null
kill -9 -- -$$ 2> /dev/null
}
trap cleanup SIGINT SIGTERM EXIT

Expand Down
1 change: 1 addition & 0 deletions src/electrum/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ impl ElectrumServer {
for (_, subscriber) in subman.subscribers.iter() {
let _ = subscriber.sender.send(Message::Done);
}
// FIXME this can deadlock
trace!(target: LT, "waiting for {} RPC threads", children.len());
for child in children {
let _ = child.join();
Expand Down

0 comments on commit b9efef2

Please sign in to comment.