Skip to content

Commit dd4d94c

Browse files
test(profiling): unflake test_gunicorn (#19694)
## Description This PR is an attempt to unflake `test_gunicorn`. `test_gunicorn` previously asserted a 5s `urlopen` timeout against a request that computes a recursive `fib(35)` inline in the handler. That work takes about 3s on 3.10 (which is the one that keeps flaking) and it seems like in practice we can accidentally timeout due to this. In the last failure on `main` ([job 1949343458](https://gitlab.ddbuild.io/DataDog/apm-reliability/dd-trace-py/-/jobs/1949343458)) the worker was healthy and did serve the request -- it logged `"GET / HTTP/1.1" 200` 5.08s after the client sent it, but after `urllib` gave up. The auto-retry in the same job passed with the identical request taking 4.37s, so pass/fail hinged on ~600ms of runner jitter. Co-authored-by: thomas.kowalski <thomas.kowalski@datadoghq.com>
1 parent 99fd46a commit dd4d94c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/profiling/test_gunicorn.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def _test_gunicorn(
107107

108108
debug_print("Making request to gunicorn server")
109109
try:
110-
with urllib.request.urlopen("http://127.0.0.1:7644", timeout=5) as f:
110+
# The handler computes fib(35), which takes over 3s on py3.10 and has been measured at
111+
# 5s on a loaded CI runner. This timeout only guards against a hung worker, so it needs
112+
# margin over that rather than to be tight.
113+
with urllib.request.urlopen("http://127.0.0.1:7644", timeout=20) as f:
111114
status_code = f.getcode()
112115
assert status_code == 200, status_code
113116
response = f.read().decode()

0 commit comments

Comments
 (0)