fix: coro_http_test间歇性CI失败(assert崩溃 + handle_uri空指针)#1189
Merged
Conversation
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>
|
for detail, goto summary download Artifacts |
|
for detail, goto summary download Artifacts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
coro_http_test 在 CI 上间歇性失败,有两个独立的触发点:
test ssl client (line 294/301): 连接 www.baidu.com 后用
assert(result.status == 200)做硬断言。CI runner 连外部服务偶尔返回 302 或超时,assert 失败直接 SIGABRT,整个进程崩溃。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 都有间歇性失败。
修复
把
assert(result.status == 200)改为CHECK(result.status >= 200),和同文件其他同类测试保持一致。CHECK 失败只标记单个用例 FAILED,不会 crash 进程。handle_uri的 IPv6 检查加!u.host.empty()前置条件,防止对空字符串调用front()。验证