MoeNetwork / Tieba-Cloud-Sign

百度贴吧云签到,在服务器上配置好就无需进行任何操作便可以实现贴吧的全自动签到。配合插件使用还可实现云灌水、点赞、封禁、删帖、审查等功能。注意:Gitee (原Git@osc) 仓库将不再维护,目前唯一指定的仓库为 Github。本项目没有官方交流群,如需交流可以直接使用Github的Discussions。没有商业版本,目前贴吧云签到由社区共同维护,不会停止更新(PR 通常在一天内处理)。
https://github.com/MoeNetwork/Tieba-Cloud-Sign/wiki
Other
1.81k stars 414 forks source link

v5.0.1版本点击"百度账号设置"加载时间很长甚至504 #261

Open zhufeng opened 4 months ago

zhufeng commented 4 months ago

问题描述

v5.0.1版本点击"百度账号设置"加载时间很长甚至直接504。

复现步骤

点击"百度账号设置"。

环境

备注

查看php-fpm的日志无异常,但nginx日志有504的报错。

2024/04/18 17:57:18 [error] 454#454: *105 upstream timed out (110: Connection timed out) while reading response header from upstream, client: [IP], server: xxx.com, request: "GET /tieba/index.php?mod=baiduid HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.com"

n0099 commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/templates/baiduid.php 看起来没有对外wcurl 是不是mysql慢查询?

zhufeng commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/templates/baiduid.php 看起来没有对外wcurl 是不是mysql慢查询?

这个要如何排查呢,账号里面在只添加了一个百度账号的情况下,也会出现加载慢的问题。 甚至刚初始化环境,还没添加账号的情况下,也会出现这个问题。

但是奇怪的是,除了这个账号设置页面,其它页面的加载速度都正常。

n0099 commented 4 months ago

在该文件里到处乱插

echo date(DATE_ATOM) . PHP_EOL;

然后

curl -v 您的tc/index.php?mod=baiduid

看卡哪行了

BANKA2017 commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/templates/baiduid.php#L139-L147

这页有个拉取登录二维码信息的对外请求,注释掉或者删掉试试,如果仍不行就不清楚了

n0099 commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/lib/class.misc.php#L629-L640

zhufeng commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/templates/baiduid.php#L139-L147

这页有个拉取登录二维码信息的对外请求,注释掉或者删掉试试,如果仍不行就不清楚了

感谢,确实是这个问题。

把 get_login_qrcode()的所在这个140行注释掉,就正常了。 <?php $login_info = misc::get_login_qrcode(); ?>

zhufeng commented 4 months ago

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/lib/class.misc.php#L629-L640

可能是ipv6的问题。

[root@ ~]# curl -v https://passport.baidu.com/v2/api/getqrcode?lp=pc
*   Trying [2409:8c00:6c21:109a:0:ff:b023:56f]:443...
* Connected to passport.baidu.com (2409:8c00:6c21:109a:0:ff:b023:56f) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* Recv failure: Connection reset by peer
* OpenSSL SSL_connect: Connection reset by peer in connection to passport.baidu.com:443
* Closing connection 0
curl: (35) Recv failure: Connection reset by peer
[root@ovm1 ~]# curl -4 -v https://passport.baidu.com/v2/api/getqrcode?lp=pc
*   Trying 103.235.46.9:443...
* Connected to passport.baidu.com (103.235.46.9) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: C=CN; ST=beijing; L=beijing; O=Beijing Baidu Netcom Science Technology Co., Ltd; CN=baidu.com
*  start date: Jul  6 01:51:06 2023 GMT
*  expire date: Aug  6 01:51:05 2024 GMT
*  subjectAltName: host "passport.baidu.com" matched cert's "*.baidu.com"
*  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign RSA OV SSL CA 2018
*  SSL certificate verify ok.
* using HTTP/1.1
> GET /v2/api/getqrcode?lp=pc HTTP/1.1
> Host: passport.baidu.com
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Expose-Headers: Trace-ID
< Connection: keep-alive
< Content-Length: 306
< Content-Type: application/json; charset=utf-8
< Date: Fri, 19 Apr 2024 02:13:23 GMT
< P3p: CP=" OTI DSP COR IVA OUR IND COM "
< Referrer-Policy: no-referrer-when-downgrade, strict-origin-when-cross-origin
< Server: BWS
< Set-Cookie: BAIDUID=*********
< Strict-Transport-Security: max-age=31536000
< Trace-Id:
< Tracecode: 34000073402849812490041910
<
* Connection #0 to host passport.baidu.com left intact
{"imgurl":"******"}

是否可以将wcurl()强制指定只解析v4地址,应该就能解决这个问题。

$get_qrcode = json_decode((new wcurl("https://passport.baidu.com/v2/api/getqrcode?lp=pc"))->get(), true);

n0099 commented 4 months ago

https://stackoverflow.com/questions/25645634/force-ipv4-in-curl-in-php-application

-         $get_qrcode = json_decode((new wcurl("https://passport.baidu.com/v2/api/getqrcode?lp=pc"))->get(), true); 
+         $get_qrcode = json_decode((new wcurl("https://passport.baidu.com/v2/api/getqrcode?lp=pc"))->set(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4)->get(), true);
ChloeKurumi commented 1 month ago

请问怎么看自己装的什么版本?怎么升级?我用的是docer compose,但是装上后显示的4.95什么情况?

n0099 commented 1 month ago

请问怎么看自己装的什么版本?

https://github.com/MoeNetwork/Tieba-Cloud-Sign/blob/09ca411da65a97808898e639466f85808c491153/init.php#L9