Skip to content

Commit 05fff8e

Browse files
teor2345dconnolly
authored andcommitted
Revert "Stop panicking when fail_with is called twice on a connection"
But keep the extra error information.
1 parent 4fe81da commit 05fff8e

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

zebra-network/src/peer/connection.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -525,31 +525,20 @@ where
525525
.lock()
526526
.expect("mutex should be unpoisoned");
527527
if let Some(original_error) = guard.clone() {
528-
// A failed connection might experience further errors if we:
529-
// 1. concurrently process two different messages
530-
// 2. check for a failed state for the second message
531-
// 3. fail the connection due to the first message
532-
// 4. fail the connection due to the second message
533-
//
534-
// It's not clear:
535-
// * if this is actually a bug,
536-
// * how we can modify Zebra to avoid it.
537-
//
538-
// This warning can also happen due to these bugs:
528+
// This panic typically happens due to these bugs:
539529
// * we mark a connection as failed without using fail_with
540530
// * we call fail_with without checking for a failed connection
541531
// state
542532
//
543-
// See the original bug #1510, the initial fix #1531, and the later
544-
// bug #1599.
545-
warn!(?original_error,
546-
new_error = ?e,
547-
connection_state = ?self.state,
548-
client_receiver = ?self.client_rx,
549-
"calling fail_with on already-failed connection state: ignoring new error");
550-
// we don't need to clean up the connection, the original call to
551-
// fail_with does that
552-
return;
533+
// See the original bug #1510 and PR #1531, and the later bug #1599
534+
// and PR #1600.
535+
panic!(
536+
"calling fail_with on already-failed connection state: failed connections must stop processing pending requests and responses, then close the connection. state: {:?} original error: {:?} new error: {:?} client receiver: {:?}",
537+
self.state,
538+
original_error,
539+
e,
540+
self.client_rx
541+
);
553542
} else {
554543
*guard = Some(e);
555544
}

0 commit comments

Comments
 (0)