From 1ce58ecb305c60e51db06e6c913b7a1344e229ca Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 22 Feb 2022 00:19:48 +0000 Subject: [PATCH] fix dispatcher panic on pending flush fixes thread panic in actix-http-3.0.0-rc.3 #2655 --- actix-http/src/h1/dispatcher.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index fbc7e5b99..f029fb108 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -931,10 +931,16 @@ where "dispatcher should not be in keep-alive phase if state is not none: {:?}", this.state, ); - debug_assert!( - this.write_buf.is_empty(), - "dispatcher should not be in keep-alive phase if write_buf is not empty", - ); + + // Assert removed by @robjtede on account of issue #2655. There are cases where an I/O + // flush can be pending after entering the keep-alive state causing the subsequent flush + // wake up to panic here. This appears to be a Linux-only problem. Leaving original code + // below for posterity because a simple and reliable test could not be found to trigger + // the behavior. + // debug_assert!( + // this.write_buf.is_empty(), + // "dispatcher should not be in keep-alive phase if write_buf is not empty", + // ); // keep-alive timer has timed out if timer.as_mut().poll(cx).is_ready() {