我是在沈阳区域的公众号开发者,从 1 月 6 号开始,分析微信的回调地址发现有 12% 左右的超时,原先的出口为联通出口,后更换为移动出口仍然是相同情况,我怀疑微信的服务器出现繁忙导致回调超时,以下是我记录的微信回调 IP,左侧是出现超时的次数,
```
435 49.235.43.218
472 175.24.213.149
484 81.69.103.37
506 81.69.103.163
512 81.69.103.129
515 124.222.246.206
517 124.223.151.119
521 42.192.0.152
533 175.24.211.4
535 175.24.211.142
542 122.51.51.45
547 110.40.132.164
554 175.24.214.222
556 81.69.101.237
557 1.15.77.182
557 118.25.155.162
558 81.69.103.74
563 42.192.6.57
565 175.24.212.185
565 42.192.0.224
567 81.69.103.205
573 81.69.101.233
575 111.231.165.30
580 175.24.212.10
583 175.24.211.31
590 81.69.103.147
592 175.24.211.157
595 175.24.211.198
599 122.51.55.51
601 81.69.103.238
616 1.116.119.192
620 81.69.103.236
626 175.24.214.150
634 124.223.33.44
667 81.69.101.193
728 175.24.212.195
```
我的超时分析流程如下:
服务器记录的访问地址为`175.24.211.198 - - [13/Mar/2025:00:02:24 +0800] "POST /xxxxxx/wechatserver?signature=xxxxxx×tamp=1741795338&nonce=xxxx&openid=oxxxxx&e
ncrypt_type=aes&msg_signature=xxxxxx HTTP/1.1" 200 17 "-" "Mozilla/4.0" "-" "-" "xxxx.xxxxx.com" -"0.036" 1441 0.037 42298`,通过分析1741795338和访问时间 `13/Mar/2025:00:02:24` 的差值,如果相差超过 5 秒,则记录为超时
你好,提供一个具体的case
昵称: xxxxxx
时间: 2025-03-13 14:58:00
内容: 微信服务器向公众号推送消息或事件后,开发者5秒内没有返回
次数: 5分钟 791次
错误样例: [OpenID=o-xxxxxxxx][Stamp=1741849080][OuterIP=][3rdUrl=https://xxxxxx/xxxxxx][IP=xxxxxxxxx][Msg=Subscribe][Event=Subscribe]
报警排查指引,请见: https://mmbizurl.cn/s/MpkaZb8yg
超时是一直存在的,但是下午 3 点请求多会触发报警
日志下载地址 https://pan.baidu.com/s/1hwBTtRjuS49L7TfVs_4o7g?pwd=f8qe
上述为服务器 Nginx 日志,关键信息被脱敏,日志格式如下
'$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" "$http_user_agent" ' '"$http_x_forwarded_for" "$http_x_real_ip" "$host" ' '"$server_name" $server_port ' '$upstream_cache_status "$upstream_addr" "$upstream_status" "$upstream_response_time" ' '$request_length $request_time $remote_port
ddd
通过 Linux 分析可以看到超时请求
cat xxx.log|awk '{log_time=substr($4, 2); match($0, /timestamp=([0-9]+)/, arr); given_timestamp = arr[1];; cmd="date -d \"$(echo "log_time" | sed \"s/\\// /g\" | sed \"s/2025:/2025 /\")\" +%s"; cmd | getline log_timestamp; close(cmd); diff=log_timestamp-given_timestamp; if(diff<0) diff=-diff; if(diff >4) print diff, $0}'
通过分析发现,大约 10%左右超时,怀疑是微信服务器到业务服务器链路存在问题