Repository navigation
Fix flaky endpoint tests and misleading core backtraces - #3599
chenBright wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open findings
pthread_fd_waitis forward-declared withunsigned events, but on macOSEVFILT_READis a… · NewWaitForPipehas no return path when neitherOS_LINUXnorOS_MACOSXis defined, which will… · Newpthread_fd_waitis forward-declared withunsigned events, but on macOSEVFILT_READis a… · New This thread function uses a gtest assertion (EXPECT_EQ) from a non-test thread; gtest reporting… · New Restoring the previous SIGURG handler usesEXPECT_EQ, so a failure here won’t fail-fast and may… · New This relies onrcbeing set and numeric in the caller; ifrcis empty/non-numeric,[will… · New
What changed in this PR
This PR reduces endpoint test flakiness by removing dependencies on public hosts/network latency, and improves CI failure diagnostics by avoiding misleading backtraces from unrelated core files.
Changes:
- Rework
EndPointTest.tcp_connect/interruptto use loopback listeners, deterministic timeouts, and EINTR retry validation. - Add Linux-only coverage for connect timeouts with a full accept queue.
- Update test runner backtrace printing to trigger only on signal-based exits.
| File | Description |
|---|---|
| test/run_tests.sh | Only print core backtraces for signal exits to avoid misleading output from death-test cores. |
| test/endpoint_unittest.cpp | Replace public-host networking with local listeners; add deterministic timeout + EINTR behavior tests. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4351f48 to
b9e4341
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open findings
Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be… · New Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be… · New Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be… · New UsingCHECK_EQin a unit test cleanup path can abort the entire test process (and mask the… · New The current heuristic treats any numeric exit status > 128 as a signal exit, but processes can also… · New
6 resolved since last review
pthread_fd_waitis forward-declared withunsigned events, but on macOSEVFILT_READis a…WaitForPipehas no return path when neitherOS_LINUXnorOS_MACOSXis defined, which will…pthread_fd_waitis forward-declared withunsigned events, but on macOSEVFILT_READis a… This relies onrcbeing set and numeric in the caller; ifrcis empty/non-numeric,[will… Restoring the previous SIGURG handler usesEXPECT_EQ, so a failure here won’t fail-fast and may… This thread function uses a gtest assertion (EXPECT_EQ) from a non-test thread; gtest reporting…
🧠 Review effort: Lite
b9e4341 to
123e43f
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
5 resolved since last review
The current heuristic treats any numeric exit status > 128 as a signal exit, but processes can also… UsingCHECK_EQin a unit test cleanup path can abort the entire test process (and mask the… Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be… Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be… Several new/updated checks rely on ~50ms timeouts. On heavily contended CI machines, 50ms can be…
🧠 Review effort: Lite
123e43f to
05389e9
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open findings
These tests rely on forward declarations of non-public functions (pthread_fd_wait,… · New On loopback, successful connects should complete quickly. Using a 5s timeout increases worst-case… · New Whentcp_listenfails, this assertion provides no errno context, making CI failures harder to… · New This global has external linkage as written. Since it’s only used within this translation unit,… · Newexprspawns an external process and is unnecessary here. Prefer shell arithmetic expansion (e.g.,… · New
3 resolved since last review
🧠 Review effort: Lite
05389e9 to
0c0b5c8
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
5 resolved since last review
On loopback, successful connects should complete quickly. Using a 5s timeout increases worst-case… These tests rely on forward declarations of non-public functions (pthread_fd_wait,…exprspawns an external process and is unnecessary here. Prefer shell arithmetic expansion (e.g.,… This global has external linkage as written. Since it’s only used within this translation unit,… Whentcp_listenfails, this assertion provides no errno context, making CI failures harder to…
🧠 Review effort: Lite
0c0b5c8 to
056d860
Compare
056d860 to
7032b63
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open findings
The test referencesbutil::g_pthread_fd_wait_eintr_count, butsrc/butil/endpoint.cpponly… · New The test referencesbutil::g_pthread_fd_wait_eintr_count, butsrc/butil/endpoint.cpponly… · New On non-Linux and non-macOS builds, this function has no return path (control reaches end of… · New The revised core lookup assumes the core naming formatcore.%e.%pand will miss valid cores on… · New
2 resolved since last review
🧠 Review effort: Lite
7032b63 to
8f1ccd4
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
10 open findings
These headers are included unconditionally, which can break builds on non-POSIX platforms (e.g.,… · New This test’s determinism depends on kernel-specificlisten(backlog=0)semantics and sysctls like… · New These newly introduced test-only helpers have external linkage insidenamespace butil, which can… · New These newly introduced test-only helpers have external linkage insidenamespace butil, which can… · New These newly introduced test-only helpers have external linkage insidenamespace butil, which can… · New These newly introduced test-only helpers have external linkage insidenamespace butil, which can… · New These newly introduced test-only helpers have external linkage insidenamespace butil, which can… · New This file includesbutil/memory/scope_guard.h, but uses theBRPC_SCOPE_EXITmacro. If… · New The PR description says 'Print core backtraces only for signal exit statuses', but the updated… · New Quote the program path when invoking gdb (use\"$1\") to avoid argument-splitting issues if the… · New
4 resolved since last review
The test referencesbutil::g_pthread_fd_wait_eintr_count, butsrc/butil/endpoint.cpponly… The test referencesbutil::g_pthread_fd_wait_eintr_count, butsrc/butil/endpoint.cpponly… The revised core lookup assumes the core naming formatcore.%e.%pand will miss valid cores on… On non-Linux and non-macOS builds, this function has no return path (control reaches end of…
🧠 Review effort: Lite
8f1ccd4 to
970a66f
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open findings
These manual forward declarations can silently drift from the real definitions (or conflict with a… · New On macOS,EVFILT_READ/EVFILT_WRITEare negative filter values. Casting them tounsignedand… · New Restricting symbolization to cores named with the failing test process PID avoids stale death-test… · New This comment is inaccurate:g_sigurg_receivedis written by theSIGURGhandler (signal… · New
10 resolved since last review
These headers are included unconditionally, which can break builds on non-POSIX platforms (e.g.,… The PR description says 'Print core backtraces only for signal exit statuses', but the updated… This file includesbutil/memory/scope_guard.h, but uses theBRPC_SCOPE_EXITmacro. If… These newly introduced test-only helpers have external linkage insidenamespace butil, which can… These newly introduced test-only helpers have external linkage insidenamespace butil, which can… These newly introduced test-only helpers have external linkage insidenamespace butil, which can… These newly introduced test-only helpers have external linkage insidenamespace butil, which can… These newly introduced test-only helpers have external linkage insidenamespace butil, which can… This test’s determinism depends on kernel-specificlisten(backlog=0)semantics and sysctls like… Quote the program path when invoking gdb (use\"$1\") to avoid argument-splitting issues if the…
🧠 Review effort: Lite
970a66f to
37468bc
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open findings
4 resolved since last review
Restricting symbolization to cores named with the failing test process PID avoids stale death-test… On macOS,EVFILT_READ/EVFILT_WRITEare negative filter values. Casting them tounsignedand… These manual forward declarations can silently drift from the real definitions (or conflict with a… This comment is inaccurate:g_sigurg_receivedis written by theSIGURGhandler (signal…
🧠 Review effort: Lite
37468bc to
c388265
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
5 open findings
CastingEVFILT_READ(typically a negativeint) tounsignedis non-obvious and can be… · New This introduces a new timing-sensitive assertion with a relatively short (300ms) deadline. If the… · Newrm -f core.*only clears cores in the current directory, butfind .will also search… · New Redirecting FD 3 on the loop terminator (done 3<&0) is valid but non-obvious, especially combined… · New Redirecting FD 3 on the loop terminator (done 3<&0) is valid but non-obvious, especially combined… · New
2 resolved since last review
🧠 Review effort: Lite
c388265 to
62e5667
Compare
|
I believe this PR is ready for a final human review. I’ve evaluated the Copilot feedback and fixed the confirmed issues. The remaining comments concern existing API design, stylistic preferences, or assumptions that do not apply to these changes. The changes are limited to tests and the test runner, with no production code changes. The build, endpoint tests, and shell regression checks have passed. @wwbmmm PTAL. |



What problem does this PR solve?
Issue Number: N/A
Problem Summary:
EndPointTest.tcp_connect and EndPointTest.interrupt depended on public hosts
and network timing, causing intermittent CI failures. After an assertion
failure, the test runner could symbolize a core left by a passing death-test
child, making the failure appear to be a crash.
Observed in this CI run.
What is changed and the side effects?
Changed:
socket modes, with and without connection deadlines.
delivering signals, restoring the previous SIGURG handler afterward.
the failed test process's PID. Accept core.%e.%p (the CI format) and core.%p.
quote the program path passed to gdb.
Side effects:
longer depend on public network access or TCP accept-queue capacity.
Core symbolization requires a filename containing the failed process's PID.
Check List:
filenames with spaces, parent/child core selection, exit status, and stdin.