Fix DNS Client resource leakage and crash issues, optimize performance and deduplication - #2422
Open
yylt wants to merge 3 commits into
Open
Fix DNS Client resource leakage and crash issues, optimize performance and deduplication#2422yylt wants to merge 3 commits into
yylt wants to merge 3 commits into
Conversation
yylt
commented
Jul 21, 2026
Contributor
- HTTP3/HTTP 客户端优化与资源泄漏修复
- 修复 http_head_destroy(NULL) 在错误路径的潜在段错误
- HTTP3 不可用时返回 -1 而非 0
- 新增 http_head_reset() 支持对象复用,避免重复分配
- 在 dns_conn_stream 中缓存 http_head,实现连接级复用,减少重复分配开销
- Client TLS 内存泄漏、空指针、死锁及锁优化
- 修复 7 个 SSL wrapper 函数的空指针解引用:将空指针检查移到 pthread_mutex_lock 之前
- 修复 _dns_client_process_tls 中的死锁:_ssl_get1_session() 内部尝试获取同一把锁,改为直接调用 SSL_get1_session()
- 移除 _dns_client_tls_verify 中的冗余加锁(该函数始终在持锁状态下调用)
- 移除 _dns_client_verify_common_name 中重复的 _dns_client_server_get_tls_host_verify() 调用
- 移除未使用的 _ssl_get1_session() 函数
- DNS Server HTTPS 记录去重
- 在应答处理中对 HTTPS SVCB 记录进行去重
- 相同域名、目标和优先级的记录将被合并,避免响应列表中产生冗余条目
- Fix potential segfault when http_head_destroy(NULL) in out path - Return -1 instead of 0 when HTTP3 is not supported - Add http_head_reset() to support object reuse without reallocation - Cache http_head in dns_conn_stream for connection-level reuse
- Fix null pointer dereference in 7 SSL wrapper functions: check pointers before calling pthread_mutex_lock instead of after, which would segfault on NULL server - Fix deadlock in _dns_client_process_tls: _ssl_get1_session() was called while holding server_info->lock, but it internally tries to acquire the same lock. Replace with direct SSL_get1_session() call - Remove redundant lock acquisition in _dns_client_tls_verify since it is always called from _dns_client_process_tls with lock held - Remove duplicate _dns_client_server_get_tls_host_verify() call in _dns_client_verify_common_name - Remove unused _ssl_get1_session() function
Add duplicate check for HTTPS SVCB records in answer processing. Records with same domain, target and priority are now deduplicated to avoid redundant entries in the response list.
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.