Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Hical61/Hical
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.6.3
Choose a base ref
...
head repository: Hical61/Hical
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.4
Choose a head ref
  • 11 commits
  • 125 files changed
  • 1 contributor

Commits on May 25, 2026

  1. [docs] benchmark文档和脚本修正

    - results.md挂载从文件改目录,不存在时Docker不会误创建为目录
    - sysctl内核调优挪到快速开始流程第一步,明确要在容器启动前执行
    - collect_stats.sh补上漏掉的Fiber框架
    - 删掉过时的PowerShell FAQ,补充wrk运行模式和profiling互斥说明
    Hical61 committed May 25, 2026
    Configuration menu
    Copy the full SHA
    5ff516d View commit details
    Browse the repository at this point in the history

Commits on May 27, 2026

  1. [perf] 空闲连接扫描改成集中式,干掉per-connection的timer协程

    每条连接单独跑一个steady_timer协程太浪费了,改成每个io_context
    挂一个IdleScanner,侵入式链表+单定时器统一扫描。Entry直接放
    协程栈上零堆分配,Guard RAII管生命周期。顺手把response序列化
    的重复header构建也优化了,连接级缓存省掉每请求3次insert。
    Hical61 committed May 27, 2026
    Configuration menu
    Copy the full SHA
    1ce16d8 View commit details
    Browse the repository at this point in the history
  2. [fix] IdleScanner UAF:成员声明顺序保证析构安全

    idleScanners_ 原来声明在 baseLoop_/ioPool_ 后面,析构时 scanner 先死,
    io_context 后续清理协程帧时 Guard 还在调 unregisterEntry(),踩已释放内存。
    挪到前面让 scanner 比 io_context 活得久,顺手删掉 start() 里的 clear()。
    Hical61 committed May 27, 2026
    Configuration menu
    Copy the full SHA
    3ef14bb View commit details
    Browse the repository at this point in the history
  3. [fix] IdleScanner UAF:optional timer + shutdown() 切断双向依赖

    scanner 和 io_context 有双向依赖:协程帧 Guard 要 scanner 活着,
    scanner 的 timer 又要 io_context 的 timer_service 活着。
    靠成员声明顺序怎么摆都有一边踩野内存。
    
    timer_ 改 optional<steady_timer>,加 shutdown() 在 io_context 析构前
    把 timer cancel+reset 掉,后面 scanner 析构时不再碰 service。
    Hical61 committed May 27, 2026
    Configuration menu
    Copy the full SHA
    0fbc0d7 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2026

  1. [fix] IdleScanner UAF:声明顺序 + 析构函数 shutdown 双向堵死环形依赖

    前两次修复各只堵了一个方向:
    - 3ef14bb 只挪声明顺序(Guard→scanner),timer 那边没处理
    - 0fbc0d7 加了 shutdown(timer→service),但把声明顺序又改回去了
    
    这次两边一起处理:
    - idleScanners_ 声明在 baseLoop_/ioPool_ 前面,确保 scanner 比 io_context 后析构
    - ~HttpServer() 中显式 shutdown() 提前干掉 timer,切断对 timer_service 的引用
    Hical61 committed May 28, 2026
    Configuration menu
    Copy the full SHA
    a9ea2d5 View commit details
    Browse the repository at this point in the history
  2. [fix] Windows IOCP 偶发 SegFault:run()返回后 drain pending completions

    io_context.stop() 后 run() 立即返回,但 IOCP proactor 模式下
    关 acceptors/timers 产生的 abort completions 还在 queue 里。
    如果留到 ~io_context() 才 destroy 协程帧,~awaitable_thread 的
    两阶段 post 销毁路径在 GCC MinGW 上偶发 crash。
    
    加 restart+poll 循环让这些 completions 正常 dispatch 到协程,
    协程 catch operation_aborted 后正常退出,帧自然释放。
    Linux epoll reactor 下 poll() 无事可做第一轮退出,零开销。
    
    timer_ 改 optional<steady_timer>,加 shutdown() 在 io_context 析构前
    把 timer cancel+reset 掉,后面 scanner 析构时不再碰 service。
    Hical61 committed May 28, 2026
    Configuration menu
    Copy the full SHA
    b10ffb8 View commit details
    Browse the repository at this point in the history
  3. [fix] Windows IOCP 关服时偶发 SegFault

    根本原因:gcLoop 用的是局部 timer,stop 的时候没法从外面 cancel 掉,
    加上活跃连接的 socket 也没关,io_context 析构时直接把协程帧强杀了,
    MinGW GCC 下偶尔就炸。
    
    改动点:
    - gcLoop 的 timer 提升为成员变量 gcTimer_,stop 时能正常 cancel
    - IdleScanner 加了 closeAll(),把还挂着的 socket 全关掉
    - drain 之前先依次 cancel signals、gcTimer、closeAll,然后再循环 poll
    - poll 加了 double-confirm,防止 IOCP completion 入队有微秒级延迟漏掉
    - 顺手把 src/ 下所有源文件的 @file/@brief 文件头注释统一了
    Hical61 committed May 28, 2026
    Configuration menu
    Copy the full SHA
    4e7652d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d266215 View commit details
    Browse the repository at this point in the history
  5. [fix] IOCP SegFault:干掉 io_context::stop(),让 run() 自己退

    之前 stop() 里调 io_context::stop() 强制退出,IOCP queue 里的 abort
    completions 没人处理,~io_context 暴力 destroy 协程帧就炸了。
    drain loop 补丁打了几轮都是 heuristic,CI 高负载下还是偶发。
    
    这次换思路:不 stop 了,cancel 掉所有 pending op 再放掉 work_guard,
    协程自然退出后 run() 就回来了,queue 是空的不存在两阶段销毁。
    
    顺手修了几个之前没注意到的问题:
    - stop() 从外部线程直接操作 timer/socket 是 UB,改成 post 进去
    - WS 升级后连接没注册到 scanner,closeAll 管不到,补上了
    - signal_set 挪到成员上,不然 stop 时 cancel 不了它
    Hical61 committed May 28, 2026
    Configuration menu
    Copy the full SHA
    b6fbfc6 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2026

  1. [perf] 进行以下性能优化:

    writeLoop 加了个 drain 上限(256),别让一个连接把 CPU 全占了;
    DB 池 acquire 前先 isAlive 看一眼,死连接直接扔掉省得白 ping;
    EventLoopPool 不再傻 round-robin 了,改成挑连接最少的 loop 分发;
    idleCheckLoop 也别固定间隔瞎醒了,算好最近哪个连接过期再起来干活;
    加了个 StringPool,send 热路径上池化 string 省 malloc。
    顺手把 .clang-tidy 的命名规则修成跟实际代码风格一致的,同步了文档。
    Hical61 committed May 29, 2026
    Configuration menu
    Copy the full SHA
    b60870d View commit details
    Browse the repository at this point in the history

Commits on May 30, 2026

  1. Configuration menu
    Copy the full SHA
    df3b53e View commit details
    Browse the repository at this point in the history
Loading