nic-6443 opened a new pull request, #13507:
URL: https://github.com/apache/apisix/pull/13507

   ### Description
   
   Both `t/xrpc/redis.t` TEST 5 and `t/xrpc/prometheus.t` TEST 3 fail 
deterministically on a fresh environment; in CI this is usually masked by the 
flaky-test rerun (the first attempt seeds redis / occasionally wins the 
timing), but it wastes a rerun on most jobs and sometimes fails both attempts 
(e.g. 
https://github.com/apache/apisix/actions/runs/27267853544/job/80529410463).
   
   **redis.t TEST 5**: redis executes each pipeline as one contiguous batch, so 
on a fresh redis the first pipeline's `GET counter` always runs before any 
`INCR` and returns ngx.null; `results[2 + j] + 1` then aborts the user thread 
with `attempt to perform arithmetic on a userdata value`, which trips the 
`no_error_log` check. Reproducible 100% locally with a flushed redis. Fix: skip 
the consecutive-increment comparison when the previous value is not a number.
   
   **prometheus.t TEST 3**: the metrics scrape contains no 
`apisix_redis_commands_*` lines at all. Metrics are accumulated in a per-worker 
resty counter and flushed to the shared dict by `ngx.timer.every(1, ...)` 
(prometheus_resty_counter); exiting workers run no timers, so when TEST 2 ends 
right after the redis commands and the HUP reload (`TEST_NGINX_USE_HUP=1`) 
retires the stream worker, the unflushed deltas are lost permanently and TEST 3 
fails on both attempts. Also reproducible locally. Fix: sleep past the sync 
interval before the block ends so the flush happens while the worker is alive.
   
   Verified locally: both files fail on master with a flushed redis and pass 
with this change across repeated fresh runs.
   
   ### Which issue(s) this PR fixes:
   
   N/A
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to