Commit 2a2dc83
authored
test(bigquery): add debug info to socket leak test (#17802)
## Problem
The system test `test_dbapi_connection_does_not_leak_sockets` has been
failing intermittently with minor socket count discrepancies (e.g., 7
instead of 6). Previous attempts to fix this have not fully eliminated
the flakiness, likely due to non-deterministic garbage collection or
Operating System cleanup delays. Without knowing the exact state of
these "leaked" sockets (e.g., `TIME_WAIT` vs `CLOSE_WAIT`), it is
difficult to determine if this is a real resource leak in the
application or just OS noise.
## Solution
This PR wraps the socket count assertion in a `try...except
AssertionError` block. If the assertion fails, it captures the status,
local address, and remote address of all active network connections for
the current process and appends this information to the failure message.
## Notes to Reviewers
- This change does **not** attempt to fix the underlying flakiness or
leak. It is purely diagnostic.
- The detailed socket state will help us distinguish between expected OS
delays (`TIME_WAIT`) and real application leaks (`CLOSE_WAIT` or
`ESTABLISHED`) in future CI/CD runs.
- This approach avoids running expensive system tests repeatedly to try
and capture an intermittent failure manually.1 parent b2d3fb9 commit 2a2dc83
1 file changed
Lines changed: 20 additions & 1 deletion
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2213 | 2213 | | |
2214 | 2214 | | |
2215 | 2215 | | |
2216 | | - | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
2217 | 2236 | | |
2218 | 2237 | | |
2219 | 2238 | | |
| |||
0 commit comments