Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为回源请求配置恰当的超时时间及错误日志 #1420

Open
SakuraKoi opened this issue Jun 4, 2024 · 0 comments
Open

为回源请求配置恰当的超时时间及错误日志 #1420

SakuraKoi opened this issue Jun 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@SakuraKoi
Copy link

SakuraKoi commented Jun 4, 2024

需求描述

当music.163.com响应速度极慢时, 表现为http请求发出后没有任何回应, 并且在client侧timeout断开连接后server侧也没有任何错误日志
因此导致客户端报网络错误, 并且服务端日志中没有相关信息, 难以查找问题原因

直接发http请求到server(host方式配置), 日志什么反应都没有
使用代理方式请求, debug log只有一堆tunnel

该问题可能和 #1134 #1123 相关

预期行为

  • 为回源请求配置一个恰当的超时时间, 而不是让客户端等待几十秒都没有http响应
  • 在回源请求发生错误时打日志

网易云音乐版本号

No response

操作系统

No response

其他信息

> ping music.163.com
PING overseasv4.music.ntes53.netease.com (103.126.92.133) 56(84) bytes of data.
^C
--- overseasv4.music.ntes53.netease.com ping statistics ---
9 packets transmitted, 0 received, 100% packet loss, time 8231ms

应该可以通过添加 -f 103.126.92.133 来尝试复现?
如果复现环境ping 103.126.92.133也会timeout的话

HTTP请求测试:

> curl -k --header "Host: music.163.com" "http://127.0.0.1:2133/" -v
*   Trying 127.0.0.1:2133...
* Connected to 127.0.0.1 (127.0.0.1) port 2133
> GET / HTTP/1.1
> Host: music.163.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

> curl -k --header "Host: music.163.com" "https://127.0.0.1:2443/" -v
*   Trying 127.0.0.1:2443...
* Connected to 127.0.0.1 (127.0.0.1) port 2443
* schannel: disabled automatic use of client certificate
* schannel: using IP address, SNI is not supported by OS.
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* using HTTP/1.1
> GET / HTTP/1.1
> Host: music.163.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* schannel: server closed the connection
* Empty reply from server
* Closing connection
* schannel: shutting down SSL/TLS connection with 127.0.0.1 port 2443
curl: (52) Empty reply from server
> LOG_LEVEL=debug node app.js -p 2133:2443 -f 103.126.92.133
INFO: (app) HTTP Server running @ http://0.0.0.0:2133
INFO: (app) HTTPS Server running @ http://0.0.0.0:2443

代理方式请求测试:

> curl -k -x "http://127.0.0.1:2133" https://music.163.com -v --max-time 60
*   Trying 127.0.0.1:2133...
* Connected to 127.0.0.1 (127.0.0.1) port 2133
* CONNECT tunnel: HTTP/1.1 negotiated
* allocate connect buffer
* Establish HTTP proxy tunnel to music.163.com:443
> CONNECT music.163.com:443 HTTP/1.1
> Host: music.163.com:443
> User-Agent: curl/8.4.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection established
<
* CONNECT phase completed
* CONNECT tunnel established, response 200
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* using HTTP/1.1
> GET / HTTP/1.1
> Host: music.163.com
> User-Agent: curl/8.4.0
> Accept: */*
>
* Operation timed out after 60001 milliseconds with 0 bytes received
* Closing connection
* schannel: shutting down SSL/TLS connection with music.163.com port 443
curl: (28) Operation timed out after 60001 milliseconds with 0 bytes received
> LOG_LEVEL=debug node app.js -p 2133:2443 -f 103.126.92.133
INFO: (app) HTTP Server running @ http://0.0.0.0:2133
INFO: (app) HTTPS Server running @ http://0.0.0.0:2443
DEBUG: (server) TUNNEL
    url: "localhost:2443"
@SakuraKoi SakuraKoi added the enhancement New feature or request label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant