@@ -802,53 +802,5 @@ start_server {tags {"tls"}} {
802802 $tls_client close
803803 $plain_client close
804804 }
805- test {TLS: No busy loop when write/read handlers are removed} {
806- set host [srv 0 host]
807- set port [srv 0 port]
808- set r [valkey $host $port 0 1]
809-
810- set pid [s process_id]
811- set statfile " /proc/$pid /stat"
812-
813- if {![file exists $statfile ]} {
814- # Cannot measure exact CPU cycles without /proc
815- continue
816- }
817-
818- # 1. Measure CPU clock ticks before sleep
819- set fd [open $statfile r]
820- set data [split [read $fd 1024] " " ]
821- close $fd
822- set utime_start [lindex $data 13]
823- set stime_start [lindex $data 14]
824-
825- # 2. Trigger the 'protectClient' (which removes both handlers)
826- # AND pipeline a PING. The PING stays entirely in the OS buffer.
827- # If the `WRITE_WANT_READ` is falsely tying up AE_READABLE polling,
828- # epoll will endlessly fire against the unread PING data.
829- $r write " DEBUG SLEEP 2\r\n "
830- $r write " PING\r\n "
831- $r flush
832-
833- assert_equal [$r read] " OK"
834- assert_equal [$r read] " PONG"
835-
836- # 3. Measure CPU clock ticks after sleep
837- set fd [open $statfile r]
838- set data [split [read $fd 1024] " " ]
839- close $fd
840- set utime_end [lindex $data 13]
841- set stime_end [lindex $data 14]
842-
843- set utime_diff [expr {$utime_end - $utime_start }]
844- set stime_diff [expr {$stime_end - $stime_start }]
845- set total_cpu_ticks [expr {$utime_diff + $stime_diff }]
846-
847- # In a 2-second 100% CPU busy loop, the OS tick differential will jump
848- # heavily (usually ~200 at a standard 100Hz clock).
849- # At rest with our fix, it will be virtually 0. Accommodate CI jitter up to 30 ticks.
850- assert {$total_cpu_ticks < 30}
851- }
852-
853805 }
854806}
0 commit comments