Skip to content

Commit a0bd27f

Browse files
taegyunkimbrettlangdon
authored andcommitted
test(profiling): detect uWSGI worker crashes (#19405)
## Description Strengthens the existing uWSGI `--lazy-apps` test without `--master` by checking the PID returned from `waitpid()` and rejecting signal-based termination. This closes a test blind spot where the process could crash during shutdown while the test continued to validate generated profile samples. The sibling worker is cleaned up before the captured exit status is asserted, including on the failure path. The change is extracted from #18724 because it is independent of the CPU timer profiler. ## Testing - `scripts/run-tests --venv 1ef9287 -- -s -- -k test_uwsgi_threads_processes_no_primary_lazy_apps` - `1 passed, 12 deselected` on Python 3.13.13 with `uwsgi<2.0.30` - `scripts/lint fmt -- tests/profiling/test_uwsgi.py` - `scripts/lint checks` - `git diff --check` ## Risks None. This only makes an existing test detect process crashes that it previously overlooked. ## Additional Notes No release note is needed because this is a test-only change. Co-authored-by: taegyun.kim <taegyun.kim@datadoghq.com>
1 parent 2d85a68 commit a0bd27f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/profiling/test_uwsgi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ def test_uwsgi_threads_processes_no_primary_lazy_apps(
391391
except OSError:
392392
print(f"INFO: Worker {worker_pid} was successfully killed.")
393393

394+
assert res_pid == parent_pid
395+
assert not os.WIFSIGNALED(res_status), (
396+
f"uWSGI worker {parent_pid} crashed with signal {os.WTERMSIG(res_status)} and raw wait status {res_status}"
397+
)
398+
394399
for pid in worker_pids:
395400
_wait_for_profile_samples(filename, pid, "wall-time")
396401

0 commit comments

Comments
 (0)