Repository navigation
Commit c457bb6
Prevent SIGPIPE from killing the test process on peer reset
BasicFuncTests.teardownDuringInFlightUpload_ShutsDownCleanly intermittently
killed the whole test runner on macOS/iOS CI: the process exited with signal
SIGPIPE (exit 141) and no crash backtrace, which XCTest reports as an
unexpected exit/restart and a ~24s timeout rather than a test failure.
Cause: the test HTTP server writes responses from the reactor thread via
::send() with no SIGPIPE protection. That test deliberately cancels an upload
that is still in flight against the /slow/ endpoint, so NSURLSession resets the
connection while the server is mid-response. ::send() then fails with EPIPE and
raises SIGPIPE; the test process installs no handler, so the default
disposition terminates it. The race is timing-dependent, which is why it looks
flaky and only shows up on the slower Apple CI runners.
Fix (test infrastructure only, no SDK behavior change):
- Add Socket::setNoSigPipe() and apply SO_NOSIGPIPE to every accepted
connection (Apple/BSD, where the option is per-socket).
- Pass MSG_NOSIGNAL from Socket::send() on Linux, which has no SO_NOSIGPIPE.
Both make a write to a reset peer return EPIPE, which the reactor already
handles by closing the connection.
Files changed: tests/common/SocketTools.hpp
Validated locally on macOS (arm64, Debug): the test reproduced at ~30% (5/15
runs exited 141) before the fix and passed 30/30 after; the full FuncTests
suite passes 40/40.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent c3c1ce3 commit c457bb6
1 file changed
Lines changed: 41 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
291 | 318 | | |
292 | 319 | | |
293 | 320 | | |
| |||
326 | 353 | | |
327 | 354 | | |
328 | 355 | | |
329 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
330 | 364 | | |
331 | 365 | | |
332 | 366 | | |
| |||
361 | 395 | | |
362 | 396 | | |
363 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
364 | 404 | | |
365 | 405 | | |
366 | 406 | | |
| |||
0 commit comments