From e70d333a48ced6446ef0d1c514a5e863df68437b Mon Sep 17 00:00:00 2001 From: kurt tu Date: Tue, 8 Sep 2026 21:49:54 +0800 Subject: [PATCH 1/3] tests: fix flaky t/189-http2-subreq-error-wakeup.t and t/024-access/on-abort.t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t/189 died mid-file with "IPC::Run: timeout on timer" and exit status 29: test-nginx arms IPC::Run::timeout() with the same value as curl's --max-time, and the IPC::Run timer checks integer-second time() with a 1s fudge, so when curl's launch phase crosses a second boundary the harness kills curl before its own --max-time fires and croaks, aborting the whole file and leaving shutdown_error_log checks to fail spuriously. Since the harness timer cannot be widened from the test side, make curl self-expire strictly earlier instead: append "--- curl_options: --max-time=0.9" (curl_options is appended after the scaffold's own --max-time, so curl honors the later, smaller value), leaving the IPC::Run timer more than a second of slack. t/024-access/on-abort.t TEST 7 reads the error.log exactly once after --- wait: 0.2 — the whole budget for abort detection plus the cosocket roundtrip to redis; on loaded runners this window is regularly blown. Bump the wait to 1s. Flaky CI evidence: https://github.com/openresty/lua-nginx-module/actions/runs/34126708814/job/101756976592?pr=2523 https://github.com/openresty/lua-nginx-module/actions/runs/34126708814/job/101756976782?pr=2523 Signed-off-by: tzssangglass --- t/024-access/on-abort.t | 2 +- t/189-http2-subreq-error-wakeup.t | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/t/024-access/on-abort.t b/t/024-access/on-abort.t index 70637ba862..a013d90998 100644 --- a/t/024-access/on-abort.t +++ b/t/024-access/on-abort.t @@ -372,7 +372,7 @@ delete thread 1 $ --- timeout: 0.2 --- abort ---- wait: 0.2 +--- wait: 1 --- ignore_response --- no_error_log [error] diff --git a/t/189-http2-subreq-error-wakeup.t b/t/189-http2-subreq-error-wakeup.t index 2b6adb6e19..553b806b74 100644 --- a/t/189-http2-subreq-error-wakeup.t +++ b/t/189-http2-subreq-error-wakeup.t @@ -46,6 +46,7 @@ __DATA__ --- http2 --- request GET /delay +--- curl_options: --max-time=0.9 --- timeout: 1 --- abort --- ignore_response @@ -100,6 +101,7 @@ Parent request finished, got response from subrequest --- http2 --- request GET /outer +--- curl_options: --max-time=0.9 --- timeout: 1 --- abort --- ignore_response @@ -160,6 +162,7 @@ Outer request completed --- http2 --- request GET /parallel +--- curl_options: --max-time=0.9 --- timeout: 1 --- abort --- ignore_response From 51fd7ff3da226450636ed6d4a50add71ea79e03b Mon Sep 17 00:00:00 2001 From: kurt tu Date: Wed, 9 Sep 2026 00:35:08 +0800 Subject: [PATCH 2/3] tests: fix flaky t/128-duplex-tcp-socket.t TEST 4 in CI The mock TCP server flushes the received query to tcp_query_file after every recv (Util.pm atomic-rename trick) and the test side reads the file exactly once after --- wait: 0.05. TEST 4 sends "flush_all\r\n" one byte at a time with 1ms sleeps, so on a loaded runner the forked mock server gets starved between recvs and the check samples the file while it still holds a 7- or 10-byte prefix (got 'flush_a', expected 11 bytes). Give the mock server 0.5s to drain the kernel buffer. Flaky CI evidence: https://github.com/openresty/lua-nginx-module/actions/runs/34238302357/job/102101640297?pr=2523 https://github.com/openresty/lua-nginx-module/actions/runs/34238302357/job/102101640217?pr=2523 Signed-off-by: tzssangglass --- t/128-duplex-tcp-socket.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/128-duplex-tcp-socket.t b/t/128-duplex-tcp-socket.t index 511cc20bfc..268ec79cda 100644 --- a/t/128-duplex-tcp-socket.t +++ b/t/128-duplex-tcp-socket.t @@ -355,7 +355,7 @@ F(ngx_http_lua_socket_tcp_finalize_write_part) { --- tcp_query_len: 11 --- no_error_log [error] ---- wait: 0.05 +--- wait: 0.5 From 6967dcad752e291ffd4902d1aff16f67506e7be4 Mon Sep 17 00:00:00 2001 From: kurt tu Date: Mon, 21 Sep 2026 00:55:46 +0800 Subject: [PATCH 3/3] fix flaky t/124-init-worker.t VM-close checks by matching log lines order-independently --- t/124-init-worker.t | 106 +++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/t/124-init-worker.t b/t/124-init-worker.t index c68d74bb18..adb1f91b80 100644 --- a/t/124-init-worker.t +++ b/t/124-init-worker.t @@ -784,24 +784,23 @@ ok GET /t --- grep_error_log eval: qr/lua close the global Lua VM \S+ in the cache helper process \d+|lua close the global Lua VM \S+$/ --- grep_error_log_out eval -qr/\A(?:lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \1 -lua close the global Lua VM \1 in the cache helper process \d+ -lua close the global Lua VM \1 -|lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \2 in the cache helper process \d+ -lua close the global Lua VM \2 -lua close the global Lua VM \2 -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \3 in the cache helper process \d+ -lua close the global Lua VM \3 -lua close the global Lua VM \3 in the cache helper process \d+ -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 -)(?:lua close the global Lua VM [0-9A-F]+ -)*\z/ +do { + my $close = qr/lua close the global Lua VM /; + my $helper = qr/${close}[0-9A-F]+ in the cache helper process \d+\n/; + my $plain = qr/${close}[0-9A-F]+\n/; + my $suffix = qr/ in the cache helper process \d+/; + my $skip = qr/(?:[^\n]*\n)*?/; + + qr/ + \A + (?= $skip $helper $skip $helper ) # at least 2 helper lines + (?! $skip $helper $skip $helper $skip $helper ) # but not a 3rd one + (?= $skip $plain $skip $plain ) # at least 2 plain lines + $close ([0-9A-F]+) (?:$suffix)? \n # 1st line pins the VM address + (?: $close \1 (?:$suffix)? \n )* # later lines: same address + \z + /x; +} --- no_error_log [error] start privileged agent process @@ -830,25 +829,23 @@ start privileged agent process GET /t --- grep_error_log eval: qr/lua close the global Lua VM \S+ in the cache helper process \d+|lua close the global Lua VM \S+$/ --- grep_error_log_out eval -qr/\A(?:lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \1 -lua close the global Lua VM \1 in the cache helper process \d+ -lua close the global Lua VM \1 -|lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \2 in the cache helper process \d+ -lua close the global Lua VM \2 -lua close the global Lua VM \2 -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \3 in the cache helper process \d+ -lua close the global Lua VM \3 -lua close the global Lua VM \3 in the cache helper process \d+ -)(?:lua close the global Lua VM [0-9A-F]+ -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 -lua close the global Lua VM \4 -)*\z/ +do { + my $close = qr/lua close the global Lua VM /; + my $helper = qr/${close}[0-9A-F]+ in the cache helper process \d+\n/; + my $plain = qr/${close}[0-9A-F]+\n/; + my $suffix = qr/ in the cache helper process \d+/; + my $skip = qr/(?:[^\n]*\n)*?/; + + qr/ + \A + (?= $skip $helper $skip $helper ) # at least 2 helper lines + (?! $skip $helper $skip $helper $skip $helper ) # but not a 3rd one + (?= $skip $plain $skip $plain ) # at least 2 plain lines + $close ([0-9A-F]+) (?:$suffix)? \n # 1st line pins the VM address + (?: $close \1 (?:$suffix)? \n )* # later lines: same address + \z + /x; +} --- no_error_log [error] start privileged agent process @@ -878,24 +875,23 @@ start privileged agent process GET /t --- grep_error_log eval: qr/lua close the global Lua VM \S+ in the cache helper process \d+|lua close the global Lua VM \S+$/ --- grep_error_log_out eval -qr/\A(?:lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \1 -lua close the global Lua VM \1 in the cache helper process \d+ -lua close the global Lua VM \1 -|lua close the global Lua VM ([0-9A-F]+) in the cache helper process \d+ -lua close the global Lua VM \2 in the cache helper process \d+ -lua close the global Lua VM \2 -lua close the global Lua VM \2 -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \3 in the cache helper process \d+ -lua close the global Lua VM \3 -lua close the global Lua VM \3 in the cache helper process \d+ -|lua close the global Lua VM ([0-9A-F]+) -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 in the cache helper process \d+ -lua close the global Lua VM \4 -)(?:lua close the global Lua VM [0-9A-F]+ -)*\z/ +do { + my $close = qr/lua close the global Lua VM /; + my $helper = qr/${close}[0-9A-F]+ in the cache helper process \d+\n/; + my $plain = qr/${close}[0-9A-F]+\n/; + my $suffix = qr/ in the cache helper process \d+/; + my $skip = qr/(?:[^\n]*\n)*?/; + + qr/ + \A + (?= $skip $helper $skip $helper ) # at least 2 helper lines + (?! $skip $helper $skip $helper $skip $helper ) # but not a 3rd one + (?= $skip $plain $skip $plain ) # at least 2 plain lines + $close ([0-9A-F]+) (?:$suffix)? \n # 1st line pins the VM address + (?: $close \1 (?:$suffix)? \n )* # later lines: same address + \z + /x; +} --- error_log eval qr/start privileged agent process \d+/ --- no_error_log