mirror of
https://github.com/coturn/coturn.git
synced 2026-05-12 09:40:35 +00:00
01f58677b6
The sanitize CI job (clang.yml's ASan/TSan matrix) was failing on the TCP test with "Connect: Connection refused". Root cause: ASan- and TSan-instrumented turnserver routinely takes 5-10s before it binds 3478, but the test scripts only sleep 2-5s before launching uclient. Master got away with this because the uninstrumented Linux build binds in milliseconds. Replace the static sleep with an active probe of OUR turnserver instance's log file (uniquely named via $$). Once "Total relay threads:" appears -- which netengine.c emits near the end of init -- the listener is ready and we can run uclient. Caps at 20s; if either backing process dies before that, fail fast with the actual log content rather than letting a per-protocol FAIL paper over the startup problem. The probe has to read OUR log, not /dev/tcp/127.0.0.1/3478, because a prior script's dying turnserver can still answer the bash connect() probe long enough to give a false positive in back-to-back runs. This required forcing turnserver's log to stdout (where our redirect captures it): - run_tests.sh: added --log-file=stdout --simple-log - run_tests_conf.sh: added log-file=stdout / simple-log to the conf Without that, turnserver writes to its platform-default location (syslog or /var/log/turn_*.log) and the redirected file stays empty, which both breaks the wait probe and makes the FAIL diagnostics useless. Master's `> /dev/null` accidentally worked only because nothing was reading stdout anyway. Diagnostic dump also disambiguates "log exists but is empty" from "log file missing" so future failures don't read as ambiguous. Validated in Linux Docker: 9/9 OK in each script, run back-to-back in the same shell (so a SIGPIPE-killed prior script can't leave a ghost turnserver to confuse the next one). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>