UnblockNeteaseMusic / UnblockNeteaseMusic/server
为回源请求配置恰当的超时时间及错误日志
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 762
- PR merge metrics
- No merged PRs in 30d
Description
需求描述
当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"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the app.js entry point and reproduce the host and proxy requests against 103.126.92.133, comparing normal and debug output. Trace the upstream request and TUNNEL handling to identify where stalled requests and errors are currently lost. Done means upstream requests have a bounded timeout and failures produce useful server-side logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, networking, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100