nginx_upstream_check_module icon indicating copy to clipboard operation
nginx_upstream_check_module copied to clipboard

Nginx1.26.patch and fix raise count does not increase under the TCP check

Open mofantor opened this issue 8 months ago • 0 comments
trafficstars

  • 新增ng1.26.3补丁
  • 修改README描述布局(使用markdown)
  • 修复在TCP健康检查方法下,Rase Count不增加的问题

原因分析

在tcp检查下,有keepalive存在下, 连接不会被释放

    /* This process is processing this peer now. */
    if ((peer->shm->owner == ngx_pid  ||
        (peer->pc.connection != NULL) ||
        peer->check_timeout_ev.timer_set)) {
        return;
    }

如果tcp检查是keepalive,那么当一次健康检查执行完毕后,其connection不会被置于NULL,但owner和check_timeout_ev会清空,所以这里的判断条件修改为:

    /* This process is processing this peer now. */
    if (peer->shm->owner == ngx_pid  ||
        (peer->pc.connection != NULL && peer->check_timeout_ev.timer_set)) {
            return;
    }

如果tcp的一次健康检查执行完毕,其owner和check_timeout_ev已经清空,所以只有当connection和check_timeout_ev存在,才能断定上一次检查任务还在执行。

mofantor avatar Mar 20 '25 09:03 mofantor