Skip to content

fix: coro_http_test间歇性CI失败(assert崩溃 + handle_uri空指针)#1189

Merged
qicosmos merged 3 commits into
alibaba:mainfrom
milestone-17:fix/flaky-ssl-test-v2
May 21, 2026
Merged

fix: coro_http_test间歇性CI失败(assert崩溃 + handle_uri空指针)#1189
qicosmos merged 3 commits into
alibaba:mainfrom
milestone-17:fix/flaky-ssl-test-v2

Conversation

@milestone-17
Copy link
Copy Markdown
Contributor

重提自 #1188(旧 PR 的 cla-assistant status 卡在 pending,此 PR 重新触发)。

问题

coro_http_test 在 CI 上间歇性失败,有两个独立的触发点:

  1. test ssl client (line 294/301): 连接 www.baidu.com 后用 assert(result.status == 200) 做硬断言。CI runner 连外部服务偶尔返回 302 或超时,assert 失败直接 SIGABRT,整个进程崩溃。

  2. test pass path not entire uri (line 1587): handle_uri 在解析纯路径(如 "/")时,u.host 为空但直接调用了 u.host.front() 检查 IPv6 方括号,触发空指针解引用。macOS ASan 检测到后 SIGSEGV 崩溃。

翻了 CI Daily 记录,5/18、5/16、5/11 都有间歇性失败。

修复

  1. assert(result.status == 200) 改为 CHECK(result.status >= 200),和同文件其他同类测试保持一致。CHECK 失败只标记单个用例 FAILED,不会 crash 进程。

  2. handle_uri 的 IPv6 检查加 !u.host.empty() 前置条件,防止对空字符串调用 front()

验证

  • MSVC 14.50 编译通过
  • coro_http_test 全量跑通(121 cases passed, 0 failed)
  • 暴力跑 200 次 × 2 组,0 失败

milestone-17 and others added 2 commits May 21, 2026 00:00
test_cinatra.cpp的test ssl client用例中,连接www.baidu.com后
用assert(result.status == 200)做硬断言。CI的macOS runner连外部
服务不稳定,偶尔返回302或超时,直接触发SIGABRT导致整个测试套件
被标记为失败。

同文件其他类似测试都用的CHECK(result.status >= 200),这两处改为
一致的写法。CHECK失败只会标记单个用例失败而不会crash整个进程。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
coro_http_client::handle_uri在解析URI后直接调用u.host.front()检查
IPv6方括号,但当传入纯路径(如"/")时host为空,触发未定义行为。
macOS CI的ASan检测到这个空指针解引用,导致test pass path not entire
uri用例SIGSEGV崩溃。

加一个empty()前置检查即可。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

for detail, goto summary download Artifacts base-ylt-cov-report(base commit coverage report) and ylt-cov-report(current pull request coverage report)

@github-actions
Copy link
Copy Markdown

for detail, goto summary download Artifacts base-ylt-cov-report(base commit coverage report) and ylt-cov-report(current pull request coverage report)

@qicosmos qicosmos merged commit 8404598 into alibaba:main May 21, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants