pos 访问超时 windows连接超时 497 天后未关闭 TIME_WAIT

本文详细记录了一次nginx连接后台Tomcat程序一直报错的故障排查过程,最终定位为Windows系统长时间运行导致的TCP/IP端口TIME_WAIT状态未关闭问题,并提供了相应的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:

nginx连接后台tomcat程序 一直报错

nginx的error日志如下

2018/11/08 15:18:23 [error] 3788#2876: *135590 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 42.234.50.129, server: localhost, request: "POST ……", upstream: "http://10.10.:8103/JWebService/JService", host: ""
2018/11/08 15:18:25 [error] 3788#2876: *135857 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 125.45.125.107, server: localhost, request: "", upstream: "http://10.10.:8202/JWebService/JService", host: ""
2018/11/08 15:18:26 [error] 3788#2876: *135865 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 42.233.94.168, server: localhost, request: "", upstream: "http://10.10.:8201/JWebService/JService", host: ""
2018/11/08 15:18:29 [error] 3788#2876: *135884 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 125.46.40.38, server: localhost, request: "", upstream: "http://10.10.:8202/JWebService/JService", host: ""
2018/11/08 15:18:38 [error] 3788#2876: *135927 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 219.154.200.226, server: localhost, request: "", upstream: "http://10.10.:8203/JWebService/JService", host: ""

可以看到 用户访问nginx后,nginx将请求转发给 后端tomcat服务器,一直报超时

tomcat无返回数据。

 

初步判断是tomcat的问题,重启tomcat后问题依旧存在

 

通过查询得知,服务器使用的windows版本是  

 

 

通过各种渠道询问后得知,微软官网的一个公告

从系统启动,Windows Vista 中、 在 Windows 7 中,Windows Server 2008 中和在 Windows Server 2008 R2 中的 497 天后未关闭 TIME_WAIT 状态的所有 TCP/IP 端口

症状
在计算机上运行的 Windows Vista,Windows 7,Windows Server 2008 中,还是 Windows Server 2008 R2,您遇到以下问题。

问题 1
在系统启动时从 497 天后所有在TIME_WAIT状态的 TCP/IP 端口都不会被关闭。因此, TCP/IP 端口可能会被用光,并且可能不会创建新的 TCP/IP 会话。

注意:这台计算机某些与网络相关的操作可能受此问题。例如,您试图使用某些远程管理工具来管理已超过 497 天运行的基于 Windows Server 2008 的域控制器。在此示例中,远程管理工具无法连接到域控制器。

 

 查看服务器的开机时间

开机了499天,问题正好是在两天前出现的,正是公告中所说的497天后

确定问题!!!

 

微软官网公告地址:
https://support.microsoft.com/zh-cn/help/2553549/all-the-tcp-ip-ports-that-are-in-a-time-wait-status-are-not-closed-aft?tdsourcetag=s_pctim_aiomsg

 

 

解决方法:

补丁包已经无法下载了,所有直接使用微软官方的更新程序

 

转载于:https://www.cnblogs.com/centos2017/p/9930291.html

typedef struct { uint8_t current_state; // 当前状态机状态 uint8_t button_status; // 按钮状态标记 uint32_t timeout_counter;// 超时计数器 } AutoShootState_t; AutoShootState_t AutoShootState; void AutoShootStateHandler(void) { static bool is_calibrated = false; static uint8_t dart_count = 2; // 自动校准 if (!is_calibrated) { AutoCalibration(); is_calibrated = true; } switch(current_state) { /*---- 空闲状态 ----*/ case IDLE: if(shoot_rc->key.v & SHOOT_ON_KEYBOARD) { state.current_state = PULLING; state.timeout_counter = HAL_GetTick(); } break; /*---- 电机下拉阶段 ----*/ case PULLING: // 持续发送下拉指令(速度值需根据实际测试调整) CAN_CMD_GIMBAL_CAN2(1000, 1000, 0, 0); // 检测微动开关或超时(500ms超时保护) if(MICRO_SWITCH_TRIGGERED() || (HAL_GetTick() - state.timeout_counter > 500)) { state.current_state = WAIT_SWITCH; state.button_status = 1; // 记录按钮状态 } break; /*---- 等待开关触发 ----*/ case WAIT_SWITCH: // 关闭按钮(假设通过设置某个寄存器位) SET_BUTTON_STATE(CLOSED); // 延时100ms确保机械稳定(时间可调) if(HAL_GetTick() - state.timeout_counter > 100) { state.current_state = RETURNING; state.timeout_counter = HAL_GetTick(); } break; /*---- 电机归位 ----*/ case RETURNING: // 发送归位指令(速度方向与下拉相反) CAN_CMD_GIMBAL_CAN2(-800, -800, 0, 0); // 检测归位完成(可通过编码器或时间判断) if(CheckMotorPosition(HOME_POSITION) || (HAL_GetTick() - state.timeout_counter > 300)) { state.current_state = GRABBING; } break; /*---- 抓取飞镖 ----*/ case GRABBING: Mechanical_arm_task(); if(ArmGrabComplete()) { state.current_state = SHOOTING; } break; /*---- 发射阶段 ----*/ case SHOOTING: shoot_mode = SHOOT_BULLET; Shoot_Feedback_Update(); // 确保发射完成 if(ShootCompleteCheck()) { state.current_state = IDLE; // 完成循环 } break; default: state.current_state = IDLE; break; } } } } }给我修改这个状态机,并给相关的定义
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值