Skip to content

Fix DNS Client resource leakage and crash issues, optimize performance and deduplication - #2422

Open
yylt wants to merge 3 commits into
pymumu:masterfrom
yylt:new3
Open

Fix DNS Client resource leakage and crash issues, optimize performance and deduplication#2422
yylt wants to merge 3 commits into
pymumu:masterfrom
yylt:new3

Conversation

@yylt

@yylt yylt commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
  1. HTTP3/HTTP 客户端优化与资源泄漏修复
  • 修复 http_head_destroy(NULL) 在错误路径的潜在段错误
  • HTTP3 不可用时返回 -1 而非 0
  • 新增 http_head_reset() 支持对象复用,避免重复分配
  • 在 dns_conn_stream 中缓存 http_head,实现连接级复用,减少重复分配开销
  1. 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() 函数
  1. DNS Server HTTPS 记录去重
  • 在应答处理中对 HTTPS SVCB 记录进行去重
  • 相同域名、目标和优先级的记录将被合并,避免响应列表中产生冗余条目

yylt added 3 commits July 5, 2026 10:20
- 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.
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.

1 participant